Skip to content

Moocar/socket-encoder-appender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Logback Appender that encodes logs using an Encoder, and sends the result to a remote host over TCP.

Why not use the normal SocketAppender?

Strangely, the default logback Socket Appender doesn't give you control over how logs are encoded. Rather, it uses java object serialization and sends the result to a remote TCP socket, where it assumed you will deserialize messages back into a running JVM process.

In my work on logback-gelf, I needed to encode messages into GELF json before sending over TCP. Much to my annoyance, SocketAppender wouldn't allow that. Thus, this library.

Dependency information

Latest version:

<dependency>
  <groupId>me.moocar</groupId>
  <artifactId>socket-encoder-appender</artifactId>
  <version>0.1beta1</version>
</dependency>

Usage

See logback-gelf TCP configuration For an example of how to configure this appender. Note, that a null delimeter (\0 character) will be added to the end of every sent log.

Configuration

  • remoteHost: The remote server host name to send log messages to (DNS or IP). Default: "localhost"
  • port: The remote server port. Required
  • queueSize: The number of log to keep in memory while the remote server can't be reached. Default: 128
  • acceptConnectionTimeout: Milliseconds to wait for a connection to be established to the server before failing. Default: 1000

About

Logback Appender that uses encoders to send logs over TCP

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages