Friday, January 21, 2011

Enable Tomcat access log

On Windows machines Tomcat access log is not turned on by default.

The Access log is used to to log all HTTP requests coming to your server.

In order to activate Tomcat access log you simply have to add the following “Valve” to your “server.xml” file located on: <TOMCAT INSTALLATION>/conf/server.xml

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" 
prefix="localhost_access_log." suffix=".txt" pattern="common" resolveHosts="false"/>

Note that the “Value” can already appear as remarked in you “server.xml” file, so you just have to unremark it.