Question

I'm trying to set up the Chainsaw viewer. I'm not really getting how it's supposed to work.

This is my XML file in the java project to be logged(i.e the one I want to watch in Chainsaw v2):

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">

<plugin name="XMLSocketReceiver" class="org.apache.log4j.net.XMLSocketReceiver">
    <param name="decoder" value="org.apache.log4j.xml.UtilLoggingXMLDecoder"/>
    <param name="Port" value="4000"/>
    <param name="threshold" value="ALL"/>
</plugin>

<root>
  <priority value="debug"/>
</root>
</log4j:configuration>

Here's a screenshot of the Chainsaw option menu:

enter image description here

Was it helpful?

Solution

A couple of things:

  • The latest developer snapshot of Chainsaw has a lot of new features, including a reworked configuration UI that should make it simpler (File, Load Chainsaw configuration menu option). You can get it here: http://people.apache.org/~sdeboy
  • The log4j.xml file used by the application generating the logging needs to have an 'appender' entry, not a 'receiver' entry. The Chainsaw configuration will contain a 'receiver' entry once you have it set up, which again, I would suggest doing via the configuration UI (it 'receives' events generated by an 'appender'). Just choose the option to save the config file from the configuration screen, and check the box that says 'always start Chainsaw with this configuration'
  • You can use a SocketAppender/SocketHubAppender on the application logging side, or a FileAppender of some kind. If you choose to use a FileAppender, Chainsaw's configuration screen can read in your application-side log4j.xml and generate the correct configuration for you.

If you have additional questions, feel free to send them here or to the log4j users mailing list, available here: http://logging.apache.org/log4j/1.2/mail-lists.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top