Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-533

Scribe Appender

    XMLWordPrintable

Details

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • logback-classic
    • None

    Description

      (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

      1. 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

      1. Add:
      2. include "/path/to/your/thrift/contrib/fb303/if/fb303.thrift"
      3. to $SCRIBE_HOME/if/scribe.thrift
        thrift --gen java scribe.thrift

      Attachments

        Activity

          People

            logback-dev Logback dev list
            gordon@itasoftware.com Gordon Sims
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: