org.apache.log4j.rolling

## Class FilterBasedTriggeringPolicy

- java.lang.Object
- - org.apache.log4j.rolling.FilterBasedTriggeringPolicy

- All Implemented Interfaces:
    TriggeringPolicy, org.apache.log4j.spi.OptionHandler, org.apache.log4j.spi.TriggeringEventEvaluator, org.apache.log4j.xml.UnrecognizedElementHandler

      public final class FilterBasedTriggeringPolicy
      extends Object
      implements TriggeringPolicy, org.apache.log4j.spi.TriggeringEventEvaluator, org.apache.log4j.xml.UnrecognizedElementHandler

  FilterBasedTriggeringPolicy determines if rolling should be triggered by evaluating the current message against a set of filters. Unless a filter rejects a message, a rolling event will be triggered.
  Author:
    Curt Arnold

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FilterBasedTriggeringPolicy()` Creates a new FilterBasedTriggeringPolicy.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `activateOptions()`
    `void` | `addFilter(org.apache.log4j.spi.Filter newFilter)` Add a filter to end of the filter list.
    `void` | `clearFilters()` Clear the filters chain.
    `org.apache.log4j.spi.Filter` | `getFilter()` Returns the head Filter.
    `boolean` | `isTriggeringEvent(org.apache.log4j.Appender appender, org.apache.log4j.spi.LoggingEvent event, String file, long fileLength)` Determines if a rollover may be appropriate at this time.
    `boolean` | `isTriggeringEvent(org.apache.log4j.spi.LoggingEvent event)`
    `boolean` | `parseUnrecognizedElement(Element element, Properties props)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FilterBasedTriggeringPolicy

          public FilterBasedTriggeringPolicy()

      Creates a new FilterBasedTriggeringPolicy.

  - ### Method Detail

    - #### isTriggeringEvent

          public boolean isTriggeringEvent(org.apache.log4j.spi.LoggingEvent event)

      Specified by:
        `isTriggeringEvent` in interface `org.apache.log4j.spi.TriggeringEventEvaluator`

    - #### isTriggeringEvent

          public boolean isTriggeringEvent(org.apache.log4j.Appender appender,
                                  org.apache.log4j.spi.LoggingEvent event,
                                  String file,
                                  long fileLength)

      Determines if a rollover may be appropriate at this time. If true is returned, RolloverPolicy.rollover will be called but it can determine that a rollover is not warranted.
      Specified by:
        `isTriggeringEvent` in interface `TriggeringPolicy`
      Parameters:
        `appender` - A reference to the appender.
        `event` - A reference to the currently event.
        `file` - The filename for the currently active log file.
        `fileLength` - Length of the file in bytes.
      Returns:
        true if a rollover should occur.

    - #### addFilter

          public void addFilter(org.apache.log4j.spi.Filter newFilter)

      Add a filter to end of the filter list.
      Parameters:
        `newFilter` - filter to add to end of list.

    - #### clearFilters

          public void clearFilters()

      Clear the filters chain.

    - #### getFilter

          public org.apache.log4j.spi.Filter getFilter()

      Returns the head Filter.
      Returns:
        head of filter chain, may be null.

    - #### activateOptions

          public void activateOptions()

      Specified by:
        `activateOptions` in interface `org.apache.log4j.spi.OptionHandler`

    - #### parseUnrecognizedElement

          public boolean parseUnrecognizedElement(Element element,
                                         Properties props)
                                           throws Exception

      Specified by:
        `parseUnrecognizedElement` in interface `org.apache.log4j.xml.UnrecognizedElementHandler`
      Throws:
        `Exception`

Copyright © 2013 The Apache Software Foundation. Licensed under the Apache License, Version 2.0

Apache Extras for Apache log4j, Apache log4j and Apache are trademarks of the Apache Software Foundation.