Class CompositeFilter
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.filter.CompositeFilter
- All Implemented Interfaces:
Iterable<Filter>
,Filter
,LifeCycle
,LifeCycle2
@Plugin(name="Filters",
category="Core",
printObject=true)
public final class CompositeFilter
extends AbstractLifeCycle
implements Iterable<Filter>, Filter
Composes and invokes one or more filters.
-
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
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
Fields inherited from interface org.apache.logging.log4j.core.Filter
ELEMENT_TYPE, EMPTY_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionstatic CompositeFilter
createFilters
(Filter[] filters) Creates a CompositeFilter.Filter an event.Filter an event.Filter an event.Filter an event.Filter an event.Filter an event.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3) Filter an event.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4) Filter an event.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) Filter an event.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) Filter an event.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) Filter an event.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) Filter an event.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) Filter an event.Filter an event.Deprecated.Filter[]
Returns the result that should be returned when the filter matches the event.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()
removeFilter
(Filter filter) int
size()
void
start()
boolean
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.toString()
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
addFilter
-
removeFilter
-
iterator
-
getFilters
Deprecated.Gets a new list over the internal filter array.- Returns:
- a new list over the internal filter array
-
getFiltersArray
-
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 interfaceLifeCycle
- Overrides:
start
in classAbstractLifeCycle
-
stop
Description copied from interface:LifeCycle2
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.- Specified by:
stop
in interfaceLifeCycle2
- Overrides:
stop
in classAbstractLifeCycle
- Parameters:
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argument- Returns:
- true if the receiver was stopped cleanly and normally, false otherwise.
-
getOnMismatch
Returns the result that should be returned when the filter does not match the event.- Specified by:
getOnMismatch
in interfaceFilter
- Returns:
- the Result that should be returned when the filter does not match the event.
-
getOnMatch
Returns the result that should be returned when the filter matches the event.- Specified by:
getOnMatch
in interfaceFilter
- Returns:
- the Result that should be returned when the filter matches the event.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object... params) Filter an event. -
filter
Filter an event. -
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1) Filter an event. -
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2) Filter an event. -
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3) Filter an event.- Specified by:
filter
in interfaceFilter
- Parameters:
logger
- The Logger.level
- The event logging Level.marker
- The Marker for the event or null.msg
- String text to filter on.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parameters- Returns:
- the Result.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4) Filter an event.- Specified by:
filter
in interfaceFilter
- Parameters:
logger
- The Logger.level
- The event logging Level.marker
- The Marker for the event or null.msg
- String text to filter on.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parametersp4
- the message parameters- Returns:
- the Result.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) Filter an event.- Specified by:
filter
in interfaceFilter
- Parameters:
logger
- The Logger.level
- The event logging Level.marker
- The Marker for the event or null.msg
- String text to filter on.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parametersp4
- the message parametersp5
- the message parameters- Returns:
- the Result.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) Filter an event.- Specified by:
filter
in interfaceFilter
- Parameters:
logger
- The Logger.level
- The event logging Level.marker
- The Marker for the event or null.msg
- String text to filter on.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parametersp4
- the message parametersp5
- the message parametersp6
- the message parameters- Returns:
- the Result.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) Filter an event.- Specified by:
filter
in interfaceFilter
- Parameters:
logger
- The Logger.level
- The event logging Level.marker
- The Marker for the event or null.msg
- String text to filter on.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parametersp4
- the message parametersp5
- the message parametersp6
- the message parametersp7
- the message parameters- Returns:
- the Result.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) Filter an event.- Specified by:
filter
in interfaceFilter
- Parameters:
logger
- The Logger.level
- The event logging Level.marker
- The Marker for the event or null.msg
- String text to filter on.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parametersp4
- the message parametersp5
- the message parametersp6
- the message parametersp7
- the message parametersp8
- the message parameters- Returns:
- the Result.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) Filter an event.- Specified by:
filter
in interfaceFilter
- Parameters:
logger
- The Logger.level
- The event logging Level.marker
- The Marker for the event or null.msg
- String text to filter on.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parametersp4
- the message parametersp5
- the message parametersp6
- the message parametersp7
- the message parametersp8
- the message parametersp9
- the message parameters- Returns:
- the Result.
-
filter
Filter an event. -
filter
Filter an event. -
filter
Filter an event. -
toString
-
createFilters
@PluginFactory public static CompositeFilter createFilters(@PluginElement("Filters") Filter[] filters) Creates a CompositeFilter.- Parameters:
filters
- An array of Filters to call.- Returns:
- The CompositeFilter.
-
getFiltersArray()