Tomcat valve

Generating Log files for later analysis

To generate access log files in the logs tomcat directory of your Application. Add the following just before </Host> in conf/server.xml

 <Valve className="org.apache.catalina.valves.AccessLogValve"
                    directory="logs"
                    pattern='%h %l %u %t "%r" %s %b "%{User-Agent}i" %T'
                    prefix="localhost_access_log." resolveHosts="false" suffix=".txt"/>

The resulting log format produces lines similar to:

127.0.0.1 - - \[01/Dec/2009:12:18:56 \+0100\] "GET /portal/tool/\!gateway-710?panel=Main HTTP/1.1" 200 2618 "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091109 Ubuntu/9.10 (karmic) Firefox/3.5.5" 0.047

Information includes browser type, status, response size in bytes and response time.