Class DynamicThresholdFilter
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.filter.AbstractFilter
org.apache.logging.log4j.core.filter.DynamicThresholdFilter
- All Implemented Interfaces:
Filter
,LifeCycle
,LifeCycle2
@Plugin(name="DynamicThresholdFilter",
category="Core",
elementType="filter",
printObject=true)
public final class DynamicThresholdFilter
extends AbstractFilter
Compares against a log level that is associated with a context value. By default the context is the
ThreadContext
, but users may configure a custom
ContextDataInjector
which obtains context data from some other source.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.logging.log4j.core.filter.AbstractFilter
AbstractFilter.AbstractFilterBuilder<B extends AbstractFilter.AbstractFilterBuilder<B>>
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.filter.AbstractFilter
onMatch, onMismatch
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 DynamicThresholdFilter
createFilter
(String key, KeyValuePair[] pairs, Level defaultThreshold, Filter.Result onMatch, Filter.Result onMismatch) Creates a DynamicThresholdFilter.boolean
Context Filter method.Appender Filter method.Appender Filter method.Appender Filter method.Appender Filter method.Appender Filter method.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3) Appender Filter method.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4) Appender Filter method.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) Appender Filter method.filter
(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) Appender Filter method.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) Appender Filter method.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) Appender Filter method.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) Appender Filter method.Appender Filter method.getKey()
int
hashCode()
toString()
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilter
equalsImpl, getOnMatch, getOnMismatch, hashCodeImpl
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
getState, getStatusLogger, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop, stop, stop
-
Method Details
-
createFilter
@PluginFactory public static DynamicThresholdFilter createFilter(@PluginAttribute("key") String key, @PluginElement("Pairs") KeyValuePair[] pairs, @PluginAttribute("defaultThreshold") Level defaultThreshold, @PluginAttribute("onMatch") Filter.Result onMatch, @PluginAttribute("onMismatch") Filter.Result onMismatch) Creates a DynamicThresholdFilter.- Parameters:
key
- The name of the key to compare.pairs
- An array of value and Level pairs.defaultThreshold
- The default Level.onMatch
- The action to perform if a match occurs.onMismatch
- The action to perform if no match occurs.- Returns:
- The DynamicThresholdFilter.
-
equals
-
filter
Description copied from class:AbstractFilter
Context Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
event
- The LogEvent.- Returns:
- The Result of filtering.
-
filter
Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.t
- A throwable or null.- Returns:
- The Result of filtering.
-
filter
Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.t
- A throwable or null.- Returns:
- The Result of filtering.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object... params) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.params
- An array of parameters or null.- Returns:
- The Result of filtering.
-
filter
Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.p0
- the message parameters- Returns:
- The Result of filtering.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.p0
- the message parametersp1
- the message parameters- Returns:
- The Result of filtering.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.p0
- the message parametersp1
- the message parametersp2
- the message parameters- Returns:
- The Result of filtering.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parameters- Returns:
- The Result of filtering.
-
filter
public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object p0, Object p1, Object p2, Object p3, Object p4) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parametersp4
- the message parameters- Returns:
- The Result of filtering.
-
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) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.p0
- the message parametersp1
- the message parametersp2
- the message parametersp3
- the message parametersp4
- the message parametersp5
- the message parameters- Returns:
- The Result of filtering.
-
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) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.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 of filtering.
-
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) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.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 of filtering.
-
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) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.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 of filtering.
-
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) Description copied from class:AbstractFilter
Appender Filter method. The default returns NEUTRAL.- Specified by:
filter
in interfaceFilter
- Overrides:
filter
in classAbstractFilter
- Parameters:
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.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 of filtering.
-
getKey
-
getLevelMap
-
hashCode
public int hashCode() -
toString
- Overrides:
toString
in classAbstractFilter
-