Chapter 9. Debugging

9.1. Debugging WAF

If your server is having problems, the first step is to look for the relevant error messages. Check the following list of places to check in the order below:

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

  2. Console Checking the console for error messages sounds like a no-brainer. The only tricky thing is to remember that WAF uses log4j for all of its logging. Therefore, you can control the severity level and suppress or enable logging on package-by-package or class-by-class basis.

  3. WAF Logs The logging subsystem is based on log4j and is configured in enterprise.init in the com.arsdigita.logging.Initializer section.

    Logs are written to two files whose paths are specified by the "logFileName" and "secureLogFileName" parameters. The contents of these two files are identical. On a development box, you can set "secureLogFileName" to "/dev/null", if you want to reduce your disk I/O activity.

    WAF may also log to the console. In a development environment, you don't generally want to entirelly suppress logging. Therefore, make sure that your logging initializer is configured as follows:

    • "logFileName" must point to a file that the server can write to. You can tail this file on server startup. Assuming you have something like this in the logging initializer:

      logFileName = "/web/ccmtip/logs/ccm.log";

      you can tail the file like so:

      tail -f /web/ccmtip/logs/ccm.log

      Alternatively, you can do something like:

      logFileName = "/dev/stderr";
    • Make sure that "defaultPriority" is set to "warn" or lower.

      defaultPriority = "warn";
    • Make sure you have at least the following two categories enabled and set to "warn" or lower.

      categoryPriorities = {
          {"com.arsdigita.db", "warn"},
          {"com.arsdigita.persistence", "warn"}
      };
    • Make sure you have the console appender turned on and its threshold set equal to "warn" or lower.

      consoleAppender = "on";
      consoleThreshold = "warn";
  4. 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 want to set the log file path to "/dev/stderr", if you are too lazy to tail these files.

  5. 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 vendor specific.