How do I do Request Logging in Tomcat version 3.x?

The answer is that you can't with the installation of Tomcat that you downloaded from the Jakarta web site. I've written a RequestLogger that allows you to log your web-based requests in any text based format that you want to a file.

This is currently the first version and was done in a little less than a day, so it might be a little rough, but it works on our servers here. To install it:

  1. Download the JAR file and save it in your %TOMCAT_HOME%/lib directory
  2. Modify your server.xml file. You will need to add a section like:
       <RequestInterceptor 
            className="com.thwt.tomcat.RequestLogger" 
            logMask  = "Logging Mask" 
            fileName = "File Name" 
            logTime  = "Log Time"
        />
  3. Restart Tomcat. You must restart Tomcat for any changes to the sever.xml file to be reloaded, and adding or reconfiguring RequestInterceptors is no different.

Example Formats

Here are a list of things that I have left to do:

The RequestLogger is distributed under the Apache Software License, version 1.1. This basically means that you can do whatever you want with the code, but I'm not responsible for whatever it might do to your server, data, sanity, or anything else. The source code is also available

Dec 27, 2001 - I have updated RequestLogger based upon input from a few people. I have cleared up two threading issues that could have produced jibberish in the log file if the requests were timed just right. Also a problem with using Request Cookies was fixed. No other improvements were made.