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

## org.apache.logging.log4j.core.filter
Class CompositeFilter

    java.lang.Object
      org.apache.logging.log4j.core.AbstractLifeCycle
          org.apache.logging.log4j.core.filter.CompositeFilter

All Implemented Interfaces:
  Serializable, Iterable<Filter>, Filter, LifeCycle

    @Plugin(name="filters",
            category="Core",
            printObject=true)
    public final class CompositeFilter

extends AbstractLifeCycle
implements Iterable<Filter>, Filter

Composes and invokes one or more filters.

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.Filter
`Filter.Result`

Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
`LifeCycle.State`

Field Summary

Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
`LOGGER`

Fields inherited from interface org.apache.logging.log4j.core.Filter
`ELEMENT_TYPE`

Method Summary
`CompositeFilter` | `addFilter(Filter filter)`
`static CompositeFilter` | `createFilters(Filter[] filters)` Create a CompositeFilter.
`Filter.Result` | `filter(LogEvent event)` Filter an event.
`Filter.Result` | `filter(Logger logger, org.apache.logging.log4j.Level level, org.apache.logging.log4j.Marker marker, org.apache.logging.log4j.message.Message msg, Throwable t)` Filter an event.
`Filter.Result` | `filter(Logger logger, org.apache.logging.log4j.Level level, org.apache.logging.log4j.Marker marker, Object msg, Throwable t)` Filter an event.
`Filter.Result` | `filter(Logger logger, org.apache.logging.log4j.Level level, org.apache.logging.log4j.Marker marker, String msg, Object... params)` Filter an event.
`List<Filter>` | `getFilters()`
`Filter.Result` | `getOnMatch()` Returns the result that should be returned when the filter matches the event.
`Filter.Result` | `getOnMismatch()` Returns the result that should be returned when the filter does not match the event.
`boolean` | `isEmpty()` Returns whether this composite contains any filters.
`Iterator<Filter>` | `iterator()`
`CompositeFilter` | `removeFilter(Filter filter)`
`int` | `size()`
`void` | `start()`
`void` | `stop()`
`String` | `toString()`

Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
`equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
`getState, isStarted, isStopped`

Method Detail

### addFilter

    public CompositeFilter addFilter(Filter filter)

### removeFilter

    public CompositeFilter removeFilter(Filter filter)

### iterator

    public Iterator<Filter> iterator()

  Specified by:
    `iterator` in interface `Iterable<Filter>`

### getFilters

    public List<Filter> getFilters()

### isEmpty

    public boolean isEmpty()

  Returns whether this composite contains any filters.

  Returns:
    whether this composite contains any filters.

### size

    public int size()

### start

    public void start()

  Specified by:
    `start` in interface `LifeCycle`
  Overrides:
    `start` in class `AbstractLifeCycle`

### stop

    public void stop()

  Specified by:
    `stop` in interface `LifeCycle`
  Overrides:
    `stop` in class `AbstractLifeCycle`

### getOnMismatch

    public Filter.Result getOnMismatch()

  Returns the result that should be returned when the filter does not match the event.

  Specified by:
    `getOnMismatch` in interface `Filter`
  Returns:
    the Result that should be returned when the filter does not match the event.

### getOnMatch

    public Filter.Result getOnMatch()

  Returns the result that should be returned when the filter matches the event.

  Specified by:
    `getOnMatch` in interface `Filter`
  Returns:
    the Result that should be returned when the filter matches the event.

### filter

    public Filter.Result filter(Logger logger,
                                org.apache.logging.log4j.Level level,
                                org.apache.logging.log4j.Marker marker,
                                String msg,
                                Object... params)

  Filter an event.

  Specified by:
    `filter` in interface `Filter`
  Parameters:
    `logger` - The Logger.
    `level` - The event logging Level.
    `marker` - The Marker for the event or null.
    `msg` - String text to filter on.
    `params` - An array of parameters or null.
  Returns:
    the Result.

### filter

    public Filter.Result filter(Logger logger,
                                org.apache.logging.log4j.Level level,
                                org.apache.logging.log4j.Marker marker,
                                Object msg,
                                Throwable t)

  Filter an event.

  Specified by:
    `filter` in interface `Filter`
  Parameters:
    `logger` - The Logger.
    `level` - The event logging Level.
    `marker` - The Marker for the event or null.
    `msg` - Any Object.
    `t` - A Throwable or null.
  Returns:
    the Result.

### filter

    public Filter.Result filter(Logger logger,
                                org.apache.logging.log4j.Level level,
                                org.apache.logging.log4j.Marker marker,
                                org.apache.logging.log4j.message.Message msg,
                                Throwable t)

  Filter an event.

  Specified by:
    `filter` in interface `Filter`
  Parameters:
    `logger` - The Logger.
    `level` - The event logging Level.
    `marker` - The Marker for the event or null.
    `msg` - The Message
    `t` - A Throwable or null.
  Returns:
    the Result.

### filter

    public Filter.Result filter(LogEvent event)

  Filter an event.

  Specified by:
    `filter` in interface `Filter`
  Parameters:
    `event` - The Event to filter on.
  Returns:
    the Result.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### createFilters

    @PluginFactory
    public static CompositeFilter createFilters(@PluginElement(value="Filters")
                                                              Filter[] filters)

  Create a CompositeFilter.

  Parameters:
    `filters` - An array of Filters to call.
  Returns:
    The CompositeFilter.

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

Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.