Class 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 if enableLookups for the connector is false)
    • 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-threadname: Current request thread name (can compare later with stacktraces)
    • x-A(xxx): Pull xxx attribute from the servlet context
    • x-C(xxx): Pull the cookie(s) 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.
    • For any of the x-H(...) the following method will be called from the HttpServletRequest object
    • x-H(authType): getAuthType
    • x-H(characterEncoding): getCharacterEncoding
    • x-H(connectionId): getConnectionId
    • x-H(contentLength): getContentLength
    • x-H(locale): getLocale
    • x-H(protocol): getProtocol
    • x-H(remoteUser): getRemoteUser
    • x-H(requestedSessionId): getRequestedSessionId
    • x-H(requestedSessionIdFromCookie): isRequestedSessionIdFromCookie
    • x-H(requestedSessionIdValid): isRequestedSessionIdValid
    • x-H(scheme): getScheme
    • x-H(secure): isSecure
    • Constructor Detail

      • ExtendedAccessLogValve

        public ExtendedAccessLogValve()
        Creates a new ExtendedAccessLogValve instance.
    • Method Detail

      • open

        protected void open()
        Description copied from class: AccessLogValve
        Open the new log file for the date specified by dateStamp.
        Overrides:
        open in class AccessLogValve
      • 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 token
        tokenizer - the pattern tokenizer
        Returns:
        the log element, or null if 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 null if 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 null if 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 null if 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 null if 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 null if the parameter is unrecognized