Scribe Appender
---------------
Key: LBCLASSIC-243
URL: http://jira.qos.ch/browse/LBCLASSIC-243
Project: logback-classic
Issue Type: New Feature
Components: appender
Reporter: Gordon Sims
Assignee: Logback dev list
(posting on behalf of colleague Derek Libby)
We have written a ScribeAppender for internal use at ITA Software which we
would like to give back to the Logback project. The starting point for this
appender was the log4j ScribeAppender documented at:
https://github.com/pnayak/Scribe-logback-Appender/blob/master/src/java/org/apache/log4j/scribe/ScribeAppender.java
The appender currently accepts the following configuration settings:
host - The host name on which the Scribe server is running
port - The port on which the Scribe server is listening
category - The category name to use when publishing to Scribe
bucketSize - The number of messages to accumulate before publishing to Scribe
connectInterval - The number of milliseconds to wait between reconnect
attempts when connection is lost. The appender is blocked during this time
Issues:
The most obvious issue to me is the new dependencies this appender
introduces on the scribe, thrift and fb303 jars. To my knowledge these are not
available in any of the public maven repositories. Details on how I built
these dependences in house are attached to this mail. Because they are not
readily available adding them as dependencies to logback-classic is probably to
burdensome. Perhaps creating a logback-extras or even a logback-scribe jar for
people to use if they so choose is the way to go.
The fact that logback encoders require a stream to which to output the
results of their formatting was a bit of a pain point. I worked around this by
passing a ByteArrayOutputStream to the appenders configured encoder and then
extracting the results from it after then encode step is completed. I also
have to check for and remove newlines from encoded log lines as there is no
need for them when publishing messges to Scribe.
We have been using this encoder on a couple of data center machines for about a
month now with no ill effects.
--
Instructions for building the jars necessary for Java to communicate with a
scribe server:
Install Thrift:
Download the thrift tarball from http://thrift.apache.org/download/
tar -xzf thrift-0.5.0.tar.gz
# Order seemed to matter with the next two lines
sudo apt-get install libboost-test1.40-dev libevent-dev automake libtool
flex bison pkg-config g++
sudo apt-get install libboost-dev
sudo apt-get install php5-dev
sudo apt-get install python-dev
cd $THRIFT_HOME
./configure
make
sudo make install
Build thrift jars
cd $THRIFT_HOME/lib/java
ant
cd $THRIFT_HOME/contrib/fb303/java
ant
Build scribe classes
cd $SCRIBE_ROOT/if
# Add:
# include "/path/to/your/thrift/contrib/fb303/if/fb303.thrift"
# to $SCRIBE_HOME/if/scribe.thrift
thrift --gen java scribe.thrift
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev