An implementation of the W3c Extended Log File Format. See
http://www.w3.org/TR/WD-logfile.html for more information about the format.
The following fields are supported:
c-dns: Client hostname
c-ip: Client ip address
bytes: bytes served
cs-method: request method
cs-uri: The full uri requested
cs-uri-query: The query string
cs-uri-stem: The uri without query string
date: The date in yyyy-mm-dd format for GMT
s-dns: The server dns entry
s-ip: The server ip address
cs(XXX): The value of header XXX from client to server
sc(XXX): The value of header XXX from server to client
sc-status: The status code
time: Time the request was served
time-taken: Time (in seconds) taken to serve the request
x-A(XXX): Pull XXX attribute from the servlet context
x-C(XXX): Pull the first cookie of the name XXX
x-R(XXX): Pull XXX attribute from the servlet request
x-S(XXX): Pull XXX attribute from the session
x-P(...): Call request.getParameter(...)
and URLencode it. Helpful to capture
certain POST parameters.
For any of the x-H(...) the following method will be called from the
HttpServletRequestObject
Log rotation can be on or off. This is dictated by the rotatable
property.
For UNIX users, another field called checkExistsis 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 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.
invoke(Request request, Response response, ValveContext context) Log a message summarizing the specified request and response, according
to the format specified by the pattern property.
public boolean
isCheckExists() Check for file existence before logging.
public boolean
isRotatable() Return true if logs are automatically rotated.
Add a lifecycle event listener to this component.
Parameters: listener - The listener to add
decodePattern
public FieldInfo[] decodePattern(String fields)(Code)
Decode the given pattern. Is public so a pattern may
allows to be validated.
Parameters: fields - The pattern to decode null on error. Otherwise array of decoded fields
Log a message summarizing the specified request and response, according
to the format specified by the pattern property.
Parameters: request - Request being processed Parameters: response - Response being processed Parameters: context - The valve context used to invoke the next valvein the current processing pipeline exception: IOException - if an input/output error has occurred exception: ServletException - if a servlet error has occurred
Remove a lifecycle event listener from this component.
Parameters: listener - The listener to add
rotate
public synchronized boolean rotate(String newFileName)(Code)
Rename the existing log file to something else. Then open the
old log file name up once again. Intended to be called by a JMX
agent.
Parameters: newFileName - The file name to move the log file entry to true if a file was rotated with no error
setCheckExists
public void setCheckExists(boolean checkExists)(Code)
Set whether to check for log file existence before logging.
Parameters: checkExists - true meaning to check for file existence.
Set the ServletRequest.attribute to look for to perform
conditional logging. Set to null to log everything.
Parameters: condition - Set to null to log everything
Prepare for the beginning of active use of the public methods of this
component. This method should be called after configure(),
and before any of the public methods of the component are utilized.
exception: LifecycleException - if this component detects a fatal errorthat prevents this component from being used
Gracefully terminate the active use of the public methods of this
component. This method should be the last one called on a given
instance of this component.
exception: LifecycleException - if this component detects a fatal errorthat needs to be reported
Fields inherited from org.apache.catalina.valves.ValveBase