|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.valves.ValveBase org.apache.catalina.valves.ExtendedAccessLogValve
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 hostnamec-ip
: Client ip addressbytes
: bytes servedcs-method
: request methodcs-uri
: The full uri requestedcs-uri-query
: The query stringcs-uri-stem
: The uri without query stringdate
: The date in yyyy-mm-dd format for GMTs-dns
: The server dns entry s-ip
: The server ip addresscs(XXX)
: The value of header XXX from client to serversc(XXX)
: The value of header XXX from server to client sc-status
: The status codetime
: Time the request was servedtime-taken
: Time (in seconds) taken to serve the requestx-A(XXX)
: Pull XXX attribute from the servlet context x-C(XXX)
: Pull the first cookie of the name XXX x-O(XXX)
: Pull the all response header values 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.
x-H(authType)
: getAuthType x-H(characterEncoding)
: getCharacterEncoding x-H(contentLength)
: getContentLength x-H(locale)
: getLocalex-H(protocol)
: getProtocol x-H(remoteUser)
: getRemoteUserx-H(requestedSessionId)
: getGequestedSessionIdx-H(requestedSessionIdFromCookie)
:
isRequestedSessionIdFromCookie x-H(requestedSessionIdValid)
:
isRequestedSessionIdValidx-H(scheme)
: getSchemex-H(secure)
: isSecureLog 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 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.
Field Summary | |
protected static java.lang.String |
info
The descriptive information about this implementation. |
protected LifecycleSupport |
lifecycle
The lifecycle event support for this component. |
Fields inherited from class org.apache.catalina.valves.ValveBase |
container, containerLog, controller, domain, mserver, next, oname |
Fields inherited from interface org.apache.catalina.Lifecycle |
AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, DESTROY_EVENT, INIT_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT |
Constructor Summary | |
ExtendedAccessLogValve()
Construct a new instance of this class with default property values. |
Method Summary | |
void |
addLifecycleListener(LifecycleListener listener)
Add a lifecycle event listener to this component. |
org.apache.catalina.valves.FieldInfo[] |
decodePattern(java.lang.String fields)
Decode the given pattern. |
LifecycleListener[] |
findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. |
java.lang.String |
getCondition()
Return whether the attribute name to look for when performing conditional loggging. |
java.lang.String |
getDirectory()
Return the directory in which we create log files. |
java.lang.String |
getFileDateFormat()
Return the date format date based log rotation. |
java.lang.String |
getInfo()
Return descriptive information about this implementation. |
java.lang.String |
getPattern()
Return the format pattern. |
java.lang.String |
getPrefix()
Return the log file prefix. |
java.lang.String |
getSuffix()
Return the log file suffix. |
void |
invoke(Request request,
Response response)
Log a message summarizing the specified request and response, according to the format specified by the pattern property. |
boolean |
isCheckExists()
Check for file existence before logging. |
boolean |
isRotatable()
Return true if logs are automatically rotated. |
void |
removeLifecycleListener(LifecycleListener listener)
Remove a lifecycle event listener from this component. |
protected java.lang.String |
responseHeader(Request request,
java.lang.String header)
write a specific response header - x-O{xxx} |
boolean |
rotate(java.lang.String newFileName)
Rename the existing log file to something else. |
void |
setCheckExists(boolean checkExists)
Set whether to check for log file existence before logging. |
void |
setCondition(java.lang.String condition)
Set the ServletRequest.attribute to look for to perform conditional logging. |
void |
setDirectory(java.lang.String directory)
Set the directory in which we create log files. |
void |
setFileDateFormat(java.lang.String fileDateFormat)
Set the date format date based log rotation. |
void |
setPattern(java.lang.String pattern)
Set the format pattern, first translating any recognized alias. |
void |
setPrefix(java.lang.String prefix)
Set the log file prefix. |
void |
setRotatable(boolean rotatable)
Set the value is we should we rotate the logs |
void |
setSuffix(java.lang.String suffix)
Set the log file suffix. |
void |
start()
Prepare for the beginning of active use of the public methods of this component. |
void |
stop()
Gracefully terminate the active use of the public methods of this component. |
Methods inherited from class org.apache.catalina.valves.ValveBase |
backgroundProcess, createObjectName, getContainer, getContainerName, getController, getDomain, getNext, getObjectName, getParentName, postDeregister, postRegister, preDeregister, preRegister, setContainer, setController, setNext, setObjectName, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static final java.lang.String info
protected LifecycleSupport lifecycle
Constructor Detail |
public ExtendedAccessLogValve()
Method Detail |
public java.lang.String getDirectory()
public void setDirectory(java.lang.String directory)
directory
- The new log file directorypublic java.lang.String getInfo()
getInfo
in interface Valve
getInfo
in class ValveBase
public java.lang.String getPattern()
public void setPattern(java.lang.String pattern)
pattern
- The new pattern patternpublic java.lang.String getPrefix()
public void setPrefix(java.lang.String prefix)
prefix
- The new log file prefixpublic boolean isRotatable()
public void setRotatable(boolean rotatable)
rotatable
- true is we should rotate.public java.lang.String getSuffix()
public void setSuffix(java.lang.String suffix)
suffix
- The new log file suffixpublic java.lang.String getCondition()
public void setCondition(java.lang.String condition)
condition
- Set to null to log everythingpublic boolean isCheckExists()
public void setCheckExists(boolean checkExists)
checkExists
- true meaning to check for file existence.public java.lang.String getFileDateFormat()
public void setFileDateFormat(java.lang.String fileDateFormat)
public void invoke(Request request, Response response) throws java.io.IOException, javax.servlet.ServletException
pattern
property.
invoke
in interface Valve
invoke
in class ValveBase
request
- Request being processedresponse
- Response being processed
java.io.IOException
- if an input/output error has occurred
javax.servlet.ServletException
- if a servlet error has occurredpublic boolean rotate(java.lang.String newFileName)
newFileName
- The file name to move the log file entry to
protected java.lang.String responseHeader(Request request, java.lang.String header)
public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic LifecycleListener[] findLifecycleListeners()
findLifecycleListeners
in interface Lifecycle
public void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener
in interface Lifecycle
listener
- The listener to addpublic void start() throws LifecycleException
configure()
,
and before any of the public methods of the component are utilized.
start
in interface Lifecycle
LifecycleException
- if this component detects a fatal error
that prevents this component from being usedpublic void stop() throws LifecycleException
stop
in interface Lifecycle
LifecycleException
- if this component detects a fatal error
that needs to be reportedpublic org.apache.catalina.valves.FieldInfo[] decodePattern(java.lang.String fields)
fields
- The pattern to decode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |