Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Expand the text, clarify server.xml question

First read this http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html and http://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/valves/AccessLogValve.htmlthe Valve chapter in Configuration Reference Guide. There is also javadoc for the class.

The following is an example of AccessLogValve configuration. If you want it to log requests processed by your web application, add it to the context file of your application (META-INF/context.xml). If you want it to log all requests, add it to the Host element in conf/server.xml file.

Starting with Tomcat 7 an AccessLogValve is already configured in the default Add something like this to your context file (also can be added to Host) (or is it conf/server.xml file ?)that is shipped with Tomcat.

No Format
<Valve
    className="org.apache.catalina.valves.AccessLogValve"
    directory="${catalina.base}/logs"
    prefix="access_log"
    fileDateFormat="yyyy-MM-dd.HH"
    suffix=".log"
    pattern="%t %H cookie:%{SESSIONID}c request:%{SESSIONID}r  %m %U %s %q %r"

/>

...