ExtendedAccessLogValve (Tomcat API Documentation)
Keywords: org.apache.catalina.valves.ExtendedAccessLogValve class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.catalina.valves
Class ExtendedAccessLogValve

    java.lang.Object
      org.apache.catalina.valves.ValveBase
          org.apache.catalina.valves.AccessLogValve
              org.apache.catalina.valves.ExtendedAccessLogValve

All Implemented Interfaces:
  javax.management.MBeanRegistration, Contained, Lifecycle, Valve

    public class ExtendedAccessLogValve

extends AccessLogValve
implements Lifecycle

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-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 HttpServletRequestObject
- `x-H(authType)`: getAuthType
- `x-H(characterEncoding)`: getCharacterEncoding
- `x-H(contentLength)`: getContentLength
- `x-H(locale)`: getLocale
- `x-H(protocol)`: getProtocol
- `x-H(remoteUser)`: getRemoteUser
- `x-H(requestedSessionId)`: getGequestedSessionId
- `x-H(requestedSessionIdFromCookie)`: isRequestedSessionIdFromCookie
- `x-H(requestedSessionIdValid)`: isRequestedSessionIdValid
- `x-H(scheme)`: getScheme
- `x-H(secure)`: isSecure

Log rotation can be on or off. This is dictated by the rotatable property.

For UvNIX 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.

Version:
  $Revision: 633907 $ $Date: 2008-03-05 17:18:09 +0100 (Wed, 05 Mar 2008) $
Author:
  Tim Funk, Peter Rossbach

Nested Class Summary
`protected class` | `ExtendedAccessLogValve.CookieElement`
`protected class` | `ExtendedAccessLogValve.DateElement`
`protected class` | `ExtendedAccessLogValve.PatternTokenizer`
`protected class` | `ExtendedAccessLogValve.RequestAttributeElement`
`protected class` | `ExtendedAccessLogValve.RequestHeaderElement`
`protected class` | `ExtendedAccessLogValve.RequestParameterElement`
`protected class` | `ExtendedAccessLogValve.ResponseAllHeaderElement` write a specific response header - x-O(xxx)
`protected class` | `ExtendedAccessLogValve.ResponseHeaderElement`
`protected class` | `ExtendedAccessLogValve.ServletContextElement`
`protected class` | `ExtendedAccessLogValve.SessionAttributeElement`
`protected class` | `ExtendedAccessLogValve.TimeElement`

Nested classes/interfaces inherited from class org.apache.catalina.valves.AccessLogValve
`AccessLogValve.AccessLogElement, AccessLogValve.ByteSentElement, AccessLogValve.DateAndTimeElement, AccessLogValve.ElapsedTimeElement, AccessLogValve.HeaderElement, AccessLogValve.HostElement, AccessLogValve.HttpStatusCodeElement, AccessLogValve.LocalAddrElement, AccessLogValve.LocalPortElement, AccessLogValve.LocalServerNameElement, AccessLogValve.LogicalUserNameElement, AccessLogValve.MethodElement, AccessLogValve.ProtocolElement, AccessLogValve.QueryElement, AccessLogValve.RemoteAddrElement, AccessLogValve.RequestElement, AccessLogValve.RequestURIElement, AccessLogValve.SessionIdElement, AccessLogValve.StringElement, AccessLogValve.ThreadNameElement, AccessLogValve.UserElement`

Field Summary
`protected static java.lang.String` | `extendedAccessLogInfo` The descriptive information about this implementation.

Fields inherited from class org.apache.catalina.valves.AccessLogValve
`condition, currentLogFile, enabled, fileDateFormat, fileDateFormatter, info, lifecycle, logElements, months, pattern, prefix, rotatable, sm, started, suffix, writer`

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()`

Method Summary
`protected AccessLogValve.AccessLogElement[]` | `createLogElements()` parse pattern string and create the array of AccessLogElement
`protected AccessLogValve.AccessLogElement` | `getClientToServerElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)`
`java.lang.String` | `getInfo()` Return descriptive information about this implementation.
`protected AccessLogValve.AccessLogElement` | `getLogElement(java.lang.String token, ExtendedAccessLogValve.PatternTokenizer tokenizer)`
`protected AccessLogValve.AccessLogElement` | `getProxyElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)`
`protected AccessLogValve.AccessLogElement` | `getServerToClientElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)`
`protected AccessLogValve.AccessLogElement` | `getServletRequestElement(java.lang.String parameter)`
`protected AccessLogValve.AccessLogElement` | `getXParameterElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)`
`protected void` | `open()` Open the new log file for the date specified by `dateStamp`.

Methods inherited from class org.apache.catalina.valves.AccessLogValve
`addLifecycleListener, backgroundProcess, findLifecycleListeners, getCondition, getDirectory, getEnabled, getFileDateFormat, getPattern, getPrefix, getSuffix, invoke, isBuffered, isCheckExists, isResolveHosts, isRotatable, log, removeLifecycleListener, rotate, setBuffered, setCheckExists, setCondition, setDirectory, setEnabled, setFileDateFormat, setPattern, setPrefix, setResolveHosts, setRotatable, setSuffix, start, stop`

Methods inherited from class org.apache.catalina.valves.ValveBase
`createObjectName, event, 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`

Methods inherited from interface org.apache.catalina.Lifecycle
`addLifecycleListener, findLifecycleListeners, removeLifecycleListener, start, stop`

Field Detail

### extendedAccessLogInfo

    protected static final java.lang.String extendedAccessLogInfo

  The descriptive information about this implementation.

  See Also:
    Constant Field Values

Constructor Detail

### ExtendedAccessLogValve

    public ExtendedAccessLogValve()

Method Detail

### getInfo

    public java.lang.String getInfo()

  Return descriptive information about this implementation.

  Specified by:
    `getInfo` in interface `Valve`
  Overrides:
    `getInfo` in class `AccessLogValve`

### open

    protected void open()

  Open the new log file for the date specified by `dateStamp`.

  Overrides:
    `open` in class `AccessLogValve`

### createLogElements

    protected AccessLogValve.AccessLogElement[] createLogElements()

  Description copied from class: `AccessLogValve`
  parse pattern string and create the array of AccessLogElement

  Overrides:
    `createLogElements` in class `AccessLogValve`

### getLogElement

    protected AccessLogValve.AccessLogElement getLogElement(java.lang.String token,
                                                            ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                     throws java.io.IOException

  Throws:
    `java.io.IOException`

### getClientToServerElement

    protected AccessLogValve.AccessLogElement getClientToServerElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                                throws java.io.IOException

  Throws:
    `java.io.IOException`

### getServerToClientElement

    protected AccessLogValve.AccessLogElement getServerToClientElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                                throws java.io.IOException

  Throws:
    `java.io.IOException`

### getProxyElement

    protected AccessLogValve.AccessLogElement getProxyElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                       throws java.io.IOException

  Throws:
    `java.io.IOException`

### getXParameterElement

    protected AccessLogValve.AccessLogElement getXParameterElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                            throws java.io.IOException

  Throws:
    `java.io.IOException`

### getServletRequestElement

    protected AccessLogValve.AccessLogElement getServletRequestElement(java.lang.String parameter)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.