Package org.apache.catalina.valves
Class ExtendedAccessLogValve
- java.lang.Object
-
- org.apache.catalina.util.LifecycleBase
-
- org.apache.catalina.util.LifecycleMBeanBase
-
- org.apache.catalina.valves.ValveBase
-
- org.apache.catalina.valves.AbstractAccessLogValve
-
- org.apache.catalina.valves.AccessLogValve
-
- org.apache.catalina.valves.ExtendedAccessLogValve
-
- All Implemented Interfaces:
javax.management.MBeanRegistration,AccessLog,Contained,JmxEnabled,Lifecycle,Valve
public class ExtendedAccessLogValve extends AccessLogValve
An implementation of the W3c Extended Log File Format. See WD-logfile-960323 for more information about the format. The following fields are supported:c-dns: Client hostname (or ip address ifenableLookupsfor the connector is false)c-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 entrys-ip: The server ip addresscs(xxx): The value of header xxx from client to serversc(xxx): The value of header xxx from server to clientsc-status: The status codetime: Time the request was servedtime-taken: Time (in seconds) taken to serve the requestx-threadname: Current request thread name (can compare later with stacktraces)x-A(xxx): Pull xxx attribute from the servlet contextx-C(xxx): Pull the cookie(s) of the name xxxx-O(xxx): Pull the all response header values xxxx-R(xxx): Pull xxx attribute from the servlet requestx-S(xxx): Pull xxx attribute from the sessionx-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 HttpServletRequest object
x-H(authType): getAuthTypex-H(characterEncoding): getCharacterEncodingx-H(connectionId): getConnectionIdx-H(contentLength): getContentLengthx-H(locale): getLocalex-H(protocol): getProtocolx-H(remoteUser): getRemoteUserx-H(requestedSessionId): getRequestedSessionIdx-H(requestedSessionIdFromCookie): isRequestedSessionIdFromCookiex-H(requestedSessionIdValid): isRequestedSessionIdValidx-H(scheme): getSchemex-H(secure): isSecure
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classExtendedAccessLogValve.CookieElementLog element that outputs the value(s) of a named cookie.protected static classExtendedAccessLogValve.DateElementLog element that outputs the date in yyyy-MM-dd format for GMT.protected static classExtendedAccessLogValve.PatternTokenizerTokenizer for parsing the log pattern string.protected static classExtendedAccessLogValve.RequestAttributeElementLog element that outputs a servlet request attribute value.protected static classExtendedAccessLogValve.RequestHeaderElementLog element that outputs a specific request header value.protected static classExtendedAccessLogValve.RequestParameterElementLog element that outputs a URL-encoded request parameter value.protected static classExtendedAccessLogValve.ResponseAllHeaderElementwrite a specific response header - x-O(xxx)protected static classExtendedAccessLogValve.ResponseHeaderElementLog element that outputs a specific response header value.protected static classExtendedAccessLogValve.ServletContextElementLog element that outputs a servlet context attribute value.protected static classExtendedAccessLogValve.SessionAttributeElementLog element that outputs a session attribute value.protected static classExtendedAccessLogValve.TimeElementLog element that outputs the time in HH:mm:ss format.-
Nested classes/interfaces inherited from class org.apache.catalina.valves.AbstractAccessLogValve
AbstractAccessLogValve.AccessLogElement, AbstractAccessLogValve.ByteSentElement, AbstractAccessLogValve.CachedElement, AbstractAccessLogValve.ConnectionStatusElement, AbstractAccessLogValve.DateAndTimeElement, AbstractAccessLogValve.DateFormatCache, AbstractAccessLogValve.ElapsedTimeElement, AbstractAccessLogValve.FirstByteTimeElement, AbstractAccessLogValve.HeaderElement, AbstractAccessLogValve.HostElement, AbstractAccessLogValve.HttpStatusCodeElement, AbstractAccessLogValve.IdentifierElement, AbstractAccessLogValve.LocalAddrElement, AbstractAccessLogValve.LocalServerNameElement, AbstractAccessLogValve.LogicalUserNameElement, AbstractAccessLogValve.MethodElement, AbstractAccessLogValve.PortElement, AbstractAccessLogValve.ProtocolElement, AbstractAccessLogValve.QueryElement, AbstractAccessLogValve.RemoteAddrElement, AbstractAccessLogValve.RequestElement, AbstractAccessLogValve.RequestURIElement, AbstractAccessLogValve.SessionIdElement, AbstractAccessLogValve.StringElement, AbstractAccessLogValve.ThreadNameElement, AbstractAccessLogValve.UserElement
-
Nested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
Lifecycle.SingleUse
-
-
Field Summary
-
Fields inherited from class org.apache.catalina.valves.AccessLogValve
currentLogFile, encoding, fileDateFormat, fileDateFormatter, prefix, renameOnRotate, rotatable, suffix, writer
-
Fields inherited from class org.apache.catalina.valves.AbstractAccessLogValve
cachedElements, condition, conditionIf, enabled, locale, localeName, logElements, pattern, requestAttributesEnabled
-
Fields inherited from class org.apache.catalina.valves.ValveBase
asyncSupported, container, containerLog, next, sm
-
Fields inherited from interface org.apache.catalina.AccessLog
PROTOCOL_ATTRIBUTE, REMOTE_ADDR_ATTRIBUTE, REMOTE_HOST_ATTRIBUTE, SERVER_NAME_ATTRIBUTE, SERVER_PORT_ATTRIBUTE
-
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
-
-
Constructor Summary
Constructors Constructor Description ExtendedAccessLogValve()Creates a new ExtendedAccessLogValve instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected AbstractAccessLogValve.AccessLogElement[]createLogElements()Parse pattern string and create the array of AccessLogElement.protected AbstractAccessLogValve.AccessLogElementgetClientToServerElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)Returns the appropriate log element for a client-to-server token.protected AbstractAccessLogValve.AccessLogElementgetLogElement(java.lang.String token, ExtendedAccessLogValve.PatternTokenizer tokenizer)Returns the appropriate log element for the given token.protected AbstractAccessLogValve.AccessLogElementgetProxyElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)Returns the appropriate log element for a proxy token.protected AbstractAccessLogValve.AccessLogElementgetServerToClientElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)Returns the appropriate log element for a server-to-client token.protected AbstractAccessLogValve.AccessLogElementgetServletRequestElement(java.lang.String parameter)Returns the appropriate log element for a servlet request method parameter.protected AbstractAccessLogValve.AccessLogElementgetXParameterElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)Returns the appropriate log element for an x-parameter token.protected voidopen()Open the new log file for the date specified bydateStamp.-
Methods inherited from class org.apache.catalina.valves.AccessLogValve
backgroundProcess, getDirectory, getEncoding, getFileDateFormat, getMaxDays, getPrefix, getSuffix, isBuffered, isCheckExists, isRenameOnRotate, isRotatable, log, rotate, rotate, setBuffered, setCheckExists, setDirectory, setEncoding, setFileDateFormat, setMaxDays, setPrefix, setRenameOnRotate, setRotatable, setSuffix, startInternal, stopInternal
-
Methods inherited from class org.apache.catalina.valves.AbstractAccessLogValve
appendQueryString, createAccessLogElement, createAccessLogElement, escapeAndAppend, escapeAndAppend, findLocale, getCondition, getConditionIf, getConditionUnless, getEnabled, getIpv6Canonical, getLocale, getMaxLogMessageBufferSize, getPattern, getRequestAttributesEnabled, invoke, log, setCondition, setConditionIf, setConditionUnless, setEnabled, setIpv6Canonical, setLocale, setMaxLogMessageBufferSize, setPattern, setRequestAttributesEnabled
-
Methods inherited from class org.apache.catalina.valves.ValveBase
getContainer, getDomainInternal, getNext, getObjectNameKeyProperties, initInternal, isAsyncSupported, setAsyncSupported, setContainer, setNext, toString
-
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregister
-
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
-
-
-
-
Method Detail
-
open
protected void open()
Description copied from class:AccessLogValveOpen the new log file for the date specified bydateStamp.- Overrides:
openin classAccessLogValve
-
createLogElements
protected AbstractAccessLogValve.AccessLogElement[] createLogElements()
Description copied from class:AbstractAccessLogValveParse pattern string and create the array of AccessLogElement.- Overrides:
createLogElementsin classAbstractAccessLogValve- Returns:
- the log elements array
-
getLogElement
protected AbstractAccessLogValve.AccessLogElement getLogElement(java.lang.String token, ExtendedAccessLogValve.PatternTokenizer tokenizer) throws java.io.IOException
Returns the appropriate log element for the given token.- Parameters:
token- the pattern tokentokenizer- the pattern tokenizer- Returns:
- the log element, or
nullif the token is unrecognized - Throws:
java.io.IOException- if an I/O error occurs while reading the pattern
-
getClientToServerElement
protected AbstractAccessLogValve.AccessLogElement getClientToServerElement(ExtendedAccessLogValve.PatternTokenizer tokenizer) throws java.io.IOException
Returns the appropriate log element for a client-to-server token.- Parameters:
tokenizer- the pattern tokenizer- Returns:
- the log element, or
nullif unrecognized - Throws:
java.io.IOException- if an I/O error occurs while reading the pattern
-
getServerToClientElement
protected AbstractAccessLogValve.AccessLogElement getServerToClientElement(ExtendedAccessLogValve.PatternTokenizer tokenizer) throws java.io.IOException
Returns the appropriate log element for a server-to-client token.- Parameters:
tokenizer- the pattern tokenizer- Returns:
- the log element, or
nullif unrecognized - Throws:
java.io.IOException- if an I/O error occurs while reading the pattern
-
getProxyElement
protected AbstractAccessLogValve.AccessLogElement getProxyElement(ExtendedAccessLogValve.PatternTokenizer tokenizer) throws java.io.IOException
Returns the appropriate log element for a proxy token.- Parameters:
tokenizer- the pattern tokenizer- Returns:
- the log element, or
nullif unrecognized - Throws:
java.io.IOException- if an I/O error occurs while reading the pattern
-
getXParameterElement
protected AbstractAccessLogValve.AccessLogElement getXParameterElement(ExtendedAccessLogValve.PatternTokenizer tokenizer) throws java.io.IOException
Returns the appropriate log element for an x-parameter token.- Parameters:
tokenizer- the pattern tokenizer- Returns:
- the log element, or
nullif unrecognized - Throws:
java.io.IOException- if an I/O error occurs while reading the pattern
-
getServletRequestElement
protected AbstractAccessLogValve.AccessLogElement getServletRequestElement(java.lang.String parameter)
Returns the appropriate log element for a servlet request method parameter.- Parameters:
parameter- the parameter name mapping to a request method- Returns:
- the log element, or
nullif the parameter is unrecognized
-
-