log4j and Chainsaw

In the verrrrry useful stuff category, today I configured log4j’s Chainsaw log exploration tool for my project and it’s just great!

(and yes, I know some of you have been using it for a long time ;-)

Basically, you just need to start the org.apache.log4j.chainsaw.Main class in addition to your application, and add this to your log4j config:

# activate this to see when the log4j config is reloaded
log4j.debug = true
# this sets a global minimal logging threshold, default=ALL
# setup for Chainsaw logging of everything
log4j.rootCategory=DEBUG, Chainsaw

And you can stop and restart Chainsaw at will without causing any harm to your running application.

Great Stuff!

9 Responses to log4j and Chainsaw

  1. Cool stuff! Wondering if there is also an eclipse plugin available I found this:


    ..not sure how good it is though.

  2. scott says:

    There is an (hopefully) even more useful version of Chainsaw (Chainsaw V2) available now – it’s WebStart enabled and provides a lot more features than the previous version.

    The WebStart link to launch it a description and screenshot are available here:


    If you’d like to run the app locally (or just look at the source), there’s an ant script on the page as well that will pull sources from CVS and start Chainsaw.

    There is also a tutorial available from the ‘Welcome’ tab.

    Among the new versions are support for processing events from a number of new sources:
    – jdk1.4 util.logging package
    – other log4j-like frameworks (log4net, log4perl etc)
    – process events stored in a database
    – receive events over udp or multicast
    – parse and tail log files (you specify the pattern in the file and Chainsaw loads the events in the UI)

    Hope this helps – if anyone has questions, feel free to email.


  3. thierry says:

    Trying Chainsaw v2, I got a Class not found exception (Application trying to find LocationInfo in package org.apache.log4j.spi instead of org.apache.log4j.spi.location) after my application starts to log messages to through a SocketAppender on port 4445.

    Anybody heard about this issue?

  4. Scott says:

    The LocationInfo provides file/line info by tearing through the stack trace, and this class was just moved to a new package.

    We’ll be working through the backward compatibility issues but for now using LocationInfo from log4j1.2.8 appenders to Chainsaw V2 isn’t working (as you’ve seen).

    Setting the LocationInfo param to false on the SocketAppender’s config should do the trick for now (hopefully) – add this to the SocketAppender config section:

  5. Scott says:

    The XML fragment didn’t show up in the comments. Here is the param (xml-ize the param node):

    param name=”LocationInfo” value=”false”

  6. Scott says:

    I’m happy to answer more questions, please post to the log4j-user mailing list:

  7. thierry says:

    Unfortunately, it doesn’t work.

    If I understand correctly, specifying LocationInfo in the config file also tries to access that class.

    Do we have any estimate date for a fix?

    Thanks a lot!

  8. Sandeep Khanna says:

    I definitely want the location info else what’s the point in using/viewing those logs!

    Can we use a version of Chainsaw that uses the log4j-1.2.8.jar and appropritate older Chainsaw jars? Would this resolve the problem for now?

  9. Pugazh says:

    Any help?

    I am trying to setup Chainsaw and getting the “java.lang.ClassNotFoundException: org.apache.log4j.spi.LocationInfo” error.

    I tried both true and false for locationInfo. No luck.

%d bloggers like this: