Chapter 13. Debugging

13.1. Debugging WAF

If your server is having problems, the first step is to look for the relevant error messages. The list of potential trouble locations should be gone through, in the order presented.

Browser

One not entirely obvious thing about error messages displayed in your browser is that sometimes there is more information available. If you look at the page source, there may be additional information hidden in the <!-- --> comments. Generally speaking, you are likely to find the same information in WAF logs.

Console

Checking the console for error messages is a standard procedure. One noteworthy item is that WAF uses Log4j for all of its logging. Therefore, you can control the severity level and suppress or enable logging on a package-by-package or class-by-class basis.

WAF Logs

The logging subsystem is based on Log4j, which comes from the Apache Jakarta Project and can be found at http://jakarta.apache.org/log4j/docs/index.html.

Log4j has very flexible configuration. WAF ships with a default configuration that sends all log messages of WARN or greater to the console (i.e. standard output). The default configuration can be overridden by placing a custom log4j.xml or log4j.properties file in the CCM_HOME/conf directory.

One of the first steps in debugging is to increase the verbosity of logging. Here is an example log4j.properties that could be used for this. In this example, the escape character "\" is used to break the line for proper print formatting; in real usage the line is not broken:

# Sample log4j.properties file to be used in debugging
# Must be placed in $CCM_HOME/conf

log4j.rootLogger=INFO, console

log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{ISO8601} \
[%5.5t] %-5p %c{2} - %m%n
log4j.appender.console=org.apache.log4j.ConsoleAppender

log4j.logger.com.arsdigita.versioning=DEBUG

For more details on log4j configuration operations, see their documentation at http://jakarta.apache.org/log4j/docs/manual.html.

Servlet/JSP container logs

This is vendor-specific. The location of your Tomcat log files is specified in server.xml. The location of Resin logs is specified in resin.conf. Again, for development, you may set the log file path to "/dev/stderr" instead of tailing these log files.

Web server logs

In the simplest configuration, you don't have an external web server but rather rely on the servlet container's built-in HTTP server. If you do have a front-end HTTP server, the location of the log files is package specific.