Class LogbackValve

java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.valves.ValveBase
ch.qos.logback.access.tomcat.LogbackValve
All Implemented Interfaces:
Context, AppenderAttachable<IAccessEvent>, FilterAttachable<IAccessEvent>, PropertyContainer, MBeanRegistration, org.apache.catalina.Contained, org.apache.catalina.JmxEnabled, org.apache.catalina.Lifecycle, org.apache.catalina.Valve

public class LogbackValve extends org.apache.catalina.valves.ValveBase implements org.apache.catalina.Lifecycle, Context, AppenderAttachable<IAccessEvent>, FilterAttachable<IAccessEvent>
This class is an implementation of tomcat's Valve interface, by extending ValveBase.

For more information on using LogbackValve please refer to the online documentation on logback-acces and tomcat.

Author:
Ceki Gülcü, Sébastien Pennec
  • Field Details

    • DEFAULT_FILENAME

      public static final String DEFAULT_FILENAME
      See Also:
    • DEFAULT_CONFIG_FILE

      public static final String DEFAULT_CONFIG_FILE
  • Constructor Details

    • LogbackValve

      public LogbackValve()
  • Method Details

    • isStarted

      public boolean isStarted()
    • startInternal

      public void startInternal() throws org.apache.catalina.LifecycleException
      Overrides:
      startInternal in class org.apache.catalina.valves.ValveBase
      Throws:
      org.apache.catalina.LifecycleException
    • addStatus

      public void addStatus(Status status)
    • addInfo

      public void addInfo(String msg)
    • addWarn

      public void addWarn(String msg)
    • addError

      public void addError(String msg, Throwable t)
    • getFilename

      public String getFilename()
    • setFilename

      public void setFilename(String filename)
    • isQuiet

      public boolean isQuiet()
    • setQuiet

      public void setQuiet(boolean quiet)
    • invoke

      public void invoke(org.apache.catalina.connector.Request request, org.apache.catalina.connector.Response response) throws IOException, javax.servlet.ServletException
      Specified by:
      invoke in interface org.apache.catalina.Valve
      Throws:
      IOException
      javax.servlet.ServletException
    • stopInternal

      protected void stopInternal() throws org.apache.catalina.LifecycleException
      Overrides:
      stopInternal in class org.apache.catalina.valves.ValveBase
      Throws:
      org.apache.catalina.LifecycleException
    • addAppender

      public void addAppender(Appender<IAccessEvent> newAppender)
      Description copied from interface: AppenderAttachable
      Add an appender.
      Specified by:
      addAppender in interface AppenderAttachable<IAccessEvent>
    • iteratorForAppenders

      public Iterator<Appender<IAccessEvent>> iteratorForAppenders()
      Description copied from interface: AppenderAttachable
      Get an iterator for appenders contained in the parent object.
      Specified by:
      iteratorForAppenders in interface AppenderAttachable<IAccessEvent>
    • getAppender

      public Appender<IAccessEvent> getAppender(String name)
      Description copied from interface: AppenderAttachable
      Get an appender by name.
      Specified by:
      getAppender in interface AppenderAttachable<IAccessEvent>
    • isAttached

      public boolean isAttached(Appender<IAccessEvent> appender)
      Description copied from interface: AppenderAttachable
      Returns true if the specified appender is in list of attached attached, false otherwise.
      Specified by:
      isAttached in interface AppenderAttachable<IAccessEvent>
    • detachAndStopAllAppenders

      public void detachAndStopAllAppenders()
      Description copied from interface: AppenderAttachable
      Detach and processPriorToRemoval all previously added appenders.
      Specified by:
      detachAndStopAllAppenders in interface AppenderAttachable<IAccessEvent>
    • detachAppender

      public boolean detachAppender(Appender<IAccessEvent> appender)
      Description copied from interface: AppenderAttachable
      Detach the appender passed as parameter from the list of appenders.
      Specified by:
      detachAppender in interface AppenderAttachable<IAccessEvent>
    • detachAppender

      public boolean detachAppender(String name)
      Description copied from interface: AppenderAttachable
      Detach the appender with the name passed as parameter from the list of appenders.
      Specified by:
      detachAppender in interface AppenderAttachable<IAccessEvent>
    • getInfo

      public String getInfo()
    • getStatusManager

      public StatusManager getStatusManager()
      Description copied from interface: Context
      Return the StatusManager instance in use.
      Specified by:
      getStatusManager in interface Context
      Returns:
      the StatusManager instance in use.
    • getPropertyMap

      public Map<String,String> getPropertyMap()
    • putProperty

      public void putProperty(String key, String val)
      Description copied from interface: Context
      Set a property of this context.
      Specified by:
      putProperty in interface Context
    • getProperty

      public String getProperty(String key)
      Description copied from interface: Context
      Get the property of this context.
      Specified by:
      getProperty in interface Context
      Specified by:
      getProperty in interface PropertyContainer
    • getCopyOfPropertyMap

      public Map<String,String> getCopyOfPropertyMap()
      Description copied from interface: Context
      Get a copy of the property map
      Specified by:
      getCopyOfPropertyMap in interface Context
      Specified by:
      getCopyOfPropertyMap in interface PropertyContainer
    • getObject

      public Object getObject(String key)
      Description copied from interface: Context
      A Context can act as a store for various objects used by LOGBack components.
      Specified by:
      getObject in interface Context
      Returns:
      The object stored under 'key'.
    • putObject

      public void putObject(String key, Object value)
      Description copied from interface: Context
      Store an object under 'key'. If no object can be found, null is returned.
      Specified by:
      putObject in interface Context
    • addFilter

      public void addFilter(Filter<IAccessEvent> newFilter)
      Description copied from interface: FilterAttachable
      Add a filter.
      Specified by:
      addFilter in interface FilterAttachable<IAccessEvent>
    • clearAllFilters

      public void clearAllFilters()
      Specified by:
      clearAllFilters in interface FilterAttachable<IAccessEvent>
    • getCopyOfAttachedFiltersList

      public List<Filter<IAccessEvent>> getCopyOfAttachedFiltersList()
      Description copied from interface: FilterAttachable
      Get a copy of all the filters contained within this FilterAttachable object.
      Specified by:
      getCopyOfAttachedFiltersList in interface FilterAttachable<IAccessEvent>
      Returns:
      all attached filters as a list
    • getFilterChainDecision

      public FilterReply getFilterChainDecision(IAccessEvent event)
      Description copied from interface: FilterAttachable
      Loop through the filters in the chain. As soon as a filter decides on ACCEPT or DENY, then that value is returned. If all of the filters return NEUTRAL, then NEUTRAL is returned.
      Specified by:
      getFilterChainDecision in interface FilterAttachable<IAccessEvent>
    • getExecutorService

      public ExecutorService getExecutorService()
      Description copied from interface: Context
      Every context has an ExecutorService which be invoked to execute certain tasks in a separate thread.
      Specified by:
      getExecutorService in interface Context
      Returns:
      the executor for this context.
    • getName

      public String getName()
      Description copied from interface: Context
      Contexts are named objects.
      Specified by:
      getName in interface Context
      Returns:
      the name for this context
    • setName

      public void setName(String name)
      Description copied from interface: Context
      The name of the context can be set only once.
      Specified by:
      setName in interface Context
    • getBirthTime

      public long getBirthTime()
      Description copied from interface: Context
      The time at which this context was created, expressed in millisecond elapsed since the epoch (1.1.1970).
      Specified by:
      getBirthTime in interface Context
      Returns:
      The time as measured when this class was created.
    • getConfigurationLock

      public Object getConfigurationLock()
      Description copied from interface: Context
      Object used for synchronization purposes. INTENDED FOR INTERNAL USAGE.
      Specified by:
      getConfigurationLock in interface Context
    • register

      public void register(LifeCycle component)
      Description copied from interface: Context
      Register a component that participates in the context's life cycle.

      All components registered via this method will be stopped and removed from the context when the context is reset.

      Specified by:
      register in interface Context
      Parameters:
      component - the subject component
    • addLifecycleListener

      public void addLifecycleListener(org.apache.catalina.LifecycleListener arg0)
      Specified by:
      addLifecycleListener in interface org.apache.catalina.Lifecycle
      Overrides:
      addLifecycleListener in class org.apache.catalina.util.LifecycleBase
    • findLifecycleListeners

      public org.apache.catalina.LifecycleListener[] findLifecycleListeners()
      Specified by:
      findLifecycleListeners in interface org.apache.catalina.Lifecycle
      Overrides:
      findLifecycleListeners in class org.apache.catalina.util.LifecycleBase
    • removeLifecycleListener

      public void removeLifecycleListener(org.apache.catalina.LifecycleListener arg0)
      Specified by:
      removeLifecycleListener in interface org.apache.catalina.Lifecycle
      Overrides:
      removeLifecycleListener in class org.apache.catalina.util.LifecycleBase
    • toString

      public String toString()
      Overrides:
      toString in class org.apache.catalina.valves.ValveBase
    • getScheduledExecutorService

      public ScheduledExecutorService getScheduledExecutorService()
      Description copied from interface: Context
      Returns the ScheduledExecutorService for this context.
      Specified by:
      getScheduledExecutorService in interface Context
      Returns:
    • addScheduledFuture

      public void addScheduledFuture(ScheduledFuture<?> scheduledFuture)
      Specified by:
      addScheduledFuture in interface Context