Log Lenya with Chainsaw v2

Chainsaw is a powerful GUI-based Log viewer. It's a companion application to Log4j and seems to have replaced LogFactor5. Pros are:

  • mature application, opensource, clean GUI, easy to install (web start)
  • allows you to easily view the logs of a specific component of your webapp

See also CocoonLog4J and Chainsaw homepage

Getting Chainsaw v2

Web start

  • you can launch Chainsaw with Web Start here
  • at the startup popup, select "SocketReceiver" on "Port 4445"

Installing Chainsaw locally

(not tested yet)

Configuring Lenya (using SocketAppender)

  • Set this properties in WEB-INF/web.xml (it's already in there a couple of times, just make sure that it's at least uncommented in one place) :
<init-param>
  <param-name>logger-class</param-name>
<param-value>org.apache.avalon.excalibur.logger.Log4JLoggerManager</param-value>
</init-param>

<init-param>
  <param-name>log4j-config</param-name>
  <param-value>/WEB-INF/log4j.xconf</param-value>
</init-param>
  • In WEB-INF/log4j.xconf, comment out what's there and add:
<appender name="COCOON_DEFAULT"
class="org.apache.log4j.net.SocketAppender">
   <param name="RemoteHost" value="localhost" />
   <param name="Port" value="4445" />
</appender>

<root>
  <priority value ="debug" />
  <appender-ref ref="COCOON_DEFAULT" />
</root>

Using Chainsaw

  • at the bottom of the window, a tab called "localhost.localdomain" should appear. click on it.
  • on the left side, you can select for which component of lenya you want to see the logs (right-click).
  • when you want an overview of your webapp, focus on the "Root Logger" and refine the focus on "info" (debug is way too verbose)
  • when you analyse a specific component, focus on your component and refine the focus on "debug"

Other Ressources:

  • No labels