Jul 10
25
DCM4CHEE Log file analysis with Chainsaw
DCM4CHEE is quite a complex beast, consisting of around 70 discrete services – on top of the many services delivered as part of the JBOSS application server DCM4CHEE relies upon. Many of those services offer multi-threaded services – so even on a server with a modest workload, there can be periods when a lot is going on – all of which is being logged to the central log file.
The log file is the first recourse when problems occur – or even if something happens that is simply unexpected. It can, however, be quite a challenge to untangle the log messages originating from different services or threads, and that is made even worse if there are stack dumps throughout the file. There is a way to make troubleshooting a little easier, thankfully.
Apache Chainsaw is a Java GUI application that accepts input from the log4j logging framework that DCM4CHEE uses, and offers a couple of features which make the log output easier to manage:
- A single entry for each event. While in the standard log file, events may run to several lines (and stack dumps run to several pages), Chainsaw displays each event as a single line with drill-down to more details if appropriate.
- Potentially sophisticated filtering abilities which allow (for example), display of events originating from a specific thread.
Installation
Installation couldn’t be easier – given an appropriate Java runtime is in place. On my Ubuntu laptop, unzipping the ’standalone’ package and running chainsaw.sh was all that was needed. There is a chainsaw.bat for Windows users and a .dmg easy-to-install package for Mac users.
Log File Configuration
The default configuration that comes with DCM4CHEE doesn’t work with Chainsaw, though. We need to tweak it just a little. In the DCM4CHEE configuration file server/default/conf/jboss-log4j.xml, below the lines
<appender name=”FILE” class=”org.jboss.logging.appender.RollingFileAppender”>
……
……
</appender>
.. add in the following lines:
<appender name=”XML” class=”org.jboss.logging.appender.RollingFileAppender”>
<errorHandler class=”org.jboss.logging.util.OnlyOnceErrorHandler”/>
<param name=”File” value=”${jboss.server.log.dir}/server.xml”/>
<param name=”Append” value=”false”/>
<param name=”MaxFileSize” value=”10000KB”/>
<param name=”MaxBackupIndex” value=”1″/><layout class=”org.apache.log4j.xml.XMLLayout”/>
</appender>
.. which will result in a second log file being produced. The normal ’server.log’ will be untouched, but you will also have a server.xml which can be opened in Chainsaw. The XML formatting is less efficient than the standard formatting – so you won’t get as much in the way of time coverage in the same 10MB space but that can be adjusted if necessary.
Once in Chainsaw, the events can be filtered using the ‘Refine focus’ field by adding in rules against which any of the event fields can be tested. Even easier, any of the event fields displayed in the main window has a right-click context menu, which includes ‘Add to refine focus field’. Picking this re-filters the display accoring to the value in that field (e.g. a specific Thread ID):
