Apache Tomcat 7.0.28

org.apache.catalina.valves
Class ExtendedAccessLogValve

java.lang.Object
  extended by org.apache.catalina.util.LifecycleBase
      extended by org.apache.catalina.util.LifecycleMBeanBase
          extended by org.apache.catalina.valves.ValveBase
              extended by org.apache.catalina.valves.AccessLogValve
                  extended by org.apache.catalina.valves.ExtendedAccessLogValve
All Implemented Interfaces:
MBeanRegistration, AccessLog, Contained, Lifecycle, Valve

public class ExtendedAccessLogValve
extends AccessLogValve

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:

Log 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 and 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:
$Id: ExtendedAccessLogValve.java 1223057 2011-12-25 10:00:13Z kkolinko $
Author:
Tim Funk, Peter Rossbach

Nested Class Summary
protected  class ExtendedAccessLogValve.CookieElement
           
protected static class ExtendedAccessLogValve.DateElement
           
protected static 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 static 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 String extendedAccessLogInfo
          The descriptive information about this implementation.
 
Fields inherited from class org.apache.catalina.valves.AccessLogValve
condition, conditionIf, currentLogFile, enabled, encoding, fileDateFormat, fileDateFormatter, info, locale, localeName, logElements, pattern, prefix, requestAttributesEnabled, rotatable, suffix, writer
 
Fields inherited from class org.apache.catalina.valves.ValveBase
asyncSupported, container, containerLog, next, sm
 
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase
mserver
 
Fields inherited from interface org.apache.catalina.AccessLog
PROTOCOL_ATTRIBUTE, REMOTE_ADDR_ATTRIBUTE, REMOTE_HOST_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
ExtendedAccessLogValve()
           
 
Method Summary
protected  AccessLogValve.AccessLogElement[] createLogElements()
          parse pattern string and create the array of AccessLogElement
protected  AccessLogValve.AccessLogElement getClientToServerElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
           
 String getInfo()
          Return descriptive information about this implementation.
protected  AccessLogValve.AccessLogElement getLogElement(String token, ExtendedAccessLogValve.PatternTokenizer tokenizer)
           
protected  AccessLogValve.AccessLogElement getProxyElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
           
protected  AccessLogValve.AccessLogElement getServerToClientElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
           
protected  AccessLogValve.AccessLogElement getServletRequestElement(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
backgroundProcess, createAccessLogElement, createAccessLogElement, findLocale, getCondition, getConditionIf, getConditionUnless, getDirectory, getEnabled, getEncoding, getFileDateFormat, getLocale, getPattern, getPrefix, getRequestAttributesEnabled, getSuffix, invoke, isBuffered, isCheckExists, isResolveHosts, isRotatable, log, log, rotate, setBuffered, setCheckExists, setCondition, setConditionIf, setConditionUnless, setDirectory, setEnabled, setEncoding, setFileDateFormat, setLocale, setPattern, setPrefix, setRequestAttributesEnabled, setResolveHosts, setRotatable, setSuffix, startInternal, stopInternal
 
Methods inherited from class org.apache.catalina.valves.ValveBase
event, 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
 
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

extendedAccessLogInfo

protected static final String extendedAccessLogInfo
The descriptive information about this implementation.

See Also:
Constant Field Values
Constructor Detail

ExtendedAccessLogValve

public ExtendedAccessLogValve()
Method Detail

getInfo

public 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(String token,
                                                        ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                 throws IOException
Throws:
IOException

getClientToServerElement

protected AccessLogValve.AccessLogElement getClientToServerElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                            throws IOException
Throws:
IOException

getServerToClientElement

protected AccessLogValve.AccessLogElement getServerToClientElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                            throws IOException
Throws:
IOException

getProxyElement

protected AccessLogValve.AccessLogElement getProxyElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                   throws IOException
Throws:
IOException

getXParameterElement

protected AccessLogValve.AccessLogElement getXParameterElement(ExtendedAccessLogValve.PatternTokenizer tokenizer)
                                                        throws IOException
Throws:
IOException

getServletRequestElement

protected AccessLogValve.AccessLogElement getServletRequestElement(String parameter)

Apache Tomcat 7.0.28

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