org.apache.logging.log4j.core
Interface Filter

All Superinterfaces:
LifeCycle
All Known Implementing Classes:
AbstractFilter, BurstFilter, CompositeFilter, DynamicThresholdFilter, MapFilter, MarkerFilter, RegexFilter, StructuredDataFilter, ThreadContextMapFilter, ThresholdFilter, TimeFilter

public interface Filter
extends LifeCycle

Interface that must be implemented to allow custom event filtering. It is highly recommended that applications make use of the Filters provided with this implementation before creating their own.

This interface supports "global" filters (i.e. - all events must pass through them first), attached to specific loggers and associated with Appenders. It is recommended that, where possible, Filter implementations create a generic filtering method that can be called from any of the filter methods.


Nested Class Summary
static class Filter.Result
          The result that can returned from a filter method call.
 
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
 
Field Summary
static String ELEMENT_TYPE
          Main plugin element type for Filter plugins.
 
Method Summary
 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.
 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.
 
Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
getState, isStarted, isStopped, start, stop
 

Field Detail

ELEMENT_TYPE

static final String ELEMENT_TYPE
Main plugin element type for Filter plugins.

Since:
2.1
See Also:
Constant Field Values
Method Detail

getOnMismatch

Filter.Result getOnMismatch()
Returns the result that should be returned when the filter does not match the event.

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

getOnMatch

Filter.Result getOnMatch()
Returns the result that should be returned when the filter matches the event.

Returns:
the Result that should be returned when the filter matches the event.

filter

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

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

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

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

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.

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

Filter.Result filter(LogEvent event)
Filter an event.

Parameters:
event - The Event to filter on.
Returns:
the Result.


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.