Log4j is a logging library from Apache. It consists of loggers (log events) and appenders (a destination for a log message). There’s always a rootLogger defined, plus however many other loggers you require. A logger can have several appenders attached to it which can format and write the message to the console or a file etc. The logging levels are TRACE, DEBUG, INFO, WARN, ERROR and FATAL.
A default JBoss installation uses log4j for logging. The log4j settings are configured in JBOSS_HOMEserverdefaultconfjboss-log4j.xml which sends output to both the console and JBOSS_HOMEserverdefaultlogserver.log
Chainsaw is a GUI tool for parsing and analysing log files generated by log4j. It allows you to read and filter events. It can be used to tail the server.log file allowing you to filter the messages you see rather than searching through the log file in an editor.
You can download Chainsaw from here.
Download the chainsawWebStart.jnlp file and open it up to start the Chainsaw Log viewer.
Tailing a Log file
Create a file somewhere on your system to hold configuration information for chainsaw.
Edit the filename to match where the jboss server.log is on your system.
Select the ‘view-show application wide preferences’ menu.
In the automatic configuration url field, enter the URL to your config file.
Select OK and restart Chainsaw.
You’ll see the file load up ina new tab ‘file/c:Applications/jboss-4.2.2.GA/server/default/log/server.log.
There’s a dropdown menu that lets you filter the log entries from the most verbose TRACE up to FATAL errors only.
The toolbar icons at the top let you pause the logging, configure what gets displayed and clear the screen of events among other things. The first thing to get accustomed to is drilling through the log events to see the information you’re interested in. In the left pane you can move through the logging tree to select a particular logger. Any messages from a Logger matching the one selected are highlighted in black. You can then right click on the selected logger in the tree and choose either ‘Focus on’ to filter to just those events or ‘Ignore’ to exclude them. Selecting a specific event gives you more detailed information in the lower pane.
DONT USE CHAINSAW! – If you run Chainsaw on a client and point JBoss at it, if the Chainsaw client locks up[ (which it does if left to run for a day or so) it will crash your JBoss Server because of a bug in the logging technology.