Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated links: Replaced Tomcat 7 with Tomcat 9, and using https: URL.

First read the 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 for a particular host, add it to the Host element in conf/server.xml file.

Starting with Tomcat 7, an AccessLogValve is already configured for the default host in conf/server.xml file that is shipped with Tomcat.

No Format
    pattern="%t %H cookie:%{SESSIONID}c request:%{SESSIONID}r  %m %U %s %q %r"


See the documentation for AccessLogValve for a description of what all the options above do.