Values for Tomcat 7
Values are defined as identifiers which change the pattern of the string in the log. Suppose you want to know the IP address of a remote host, which has accessed the website, then you add the combination of the following values mentioned in the log appenders. For example, let's customize the access logs for Tomcat 7. By default, access logs for Tomcat are defined as follows:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/>
We want to change the log pattern to show the time taken to process the request. We have to add the %T
in the patterns. The changed code is shown as follows:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t %T "%r" %s %b" resolveHosts="false"/>
The following table shows the values used...