.apache.org/">Apache HTTP Server
mod_log_config
module. As an additional feature, automatic rollover of log files when the date changes is also supported.
Patterns for the logged message may include constant text or any of the following replacement strings, for which the corresponding information from the specified Response is substituted:
- %a - Remote IP address
- %A - Local IP address
- %b - Bytes sent, excluding HTTP headers, or '-' if no bytes were sent
- %B - Bytes sent, excluding HTTP headers
- %h - Remote host name
- %H - Request protocol
- %l - Remote logical username from identd (always returns '-')
- %m - Request method
- %p - Local port
- %q - Query string (prepended with a '?' if it exists, otherwise an empty string
- %r - First line of the request
- %s - HTTP status code of the response
- %S - User session ID
- %t - Date and time, in Common Log Format format
- %u - Remote user that was authenticated
- %U - Requested URL path
- %v - Local server name
- %D - Time taken to process the request, in millis
- %T - Time taken to process the request, in seconds
- %I - current Request thread name (can compare later with stacktraces)
In addition, the caller can specify one of the following aliases for commonly utilized patterns:
- common -
%h %l %u %t "%r" %s %b
- combined -
%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"
There is also support to write information from the cookie, incoming header, the Session or something else in the ServletRequest.
It is modeled after the Apache HTTP Server log configuration syntax:
%{xxx}i
for incoming headers %{xxx}o
for outgoing response headers %{xxx}c
for a specific cookie %{xxx}r
xxx is an attribute in the ServletRequest %{xxx}s
xxx is an attribute in the HttpSession
Log rotation can be on or off. This is dictated by the rotatable
property.
For UNIX users, another field called checkExists
is also available. If set to true, the log file's existence will be checked before each logging. This way an external log rotator can move the file somewhere and Tomcat will start with a new file.
For JMX junkies, a public method called rotate
has been made available to allow you to tell this instance to move the existing log file to somewhere else and start writing a new log file.
Conditional logging is also supported. This can be done with the condition
property. If the value returned from ServletRequest.getAttribute(condition) yields a non-null value, the logging will be skipped.
For extended attributes coming from a getAttribute() call, it is you responsibility to ensure there are no newline or control characters.
@author Craig R. McClanahan
@author Jason Brittain
@author Remy Maucherat
@author Takayuki Kaneko
@author Peter Rossbach
@version $Id: AccessLogValve.java 1205119 2011-11-22 18:17:22Z kkolinko $