Monthly Archives: June 2014

How to change tomcat log directory ?

Log files are written by the Tomcat valve AccessLogValve. A valve, Tomcat only, is a Java class that preprocesses access requests. You can associate valves in server.xml to the containers engine, host and context.

Search TOMCAT_HOME/conf/server.xml for “AccessLogValve”. Specify the attribute directory as shown in this example:

<Valve className=”org.apache.catalina.valves.AccessLogValve”
       directory=”c:\tomcat\logs”  prefix=”localhost_access_log.” suffix=”.txt”
       pattern=”common”/>

This will cause all the access logs of the hosting container to be written to c:\tomcat\logs.