org.apache.logging.log4j.core.filter
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:
- Serializable, Filter, LifeCycle
@Plugin(name="DynamicThresholdFilter",
category="Core",
elementType="filter",
printObject=true)
public final class DynamicThresholdFilter
- extends AbstractFilter
Compare against a log level that is associated with an MDC value.
- See Also:
- Serialized Form
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.Filter |
Filter.Result |
Method Summary |
static DynamicThresholdFilter |
createFilter(String key,
KeyValuePair[] pairs,
org.apache.logging.log4j.Level defaultThreshold,
Filter.Result onMatch,
Filter.Result onMismatch)
Create the DynamicThresholdFilter. |
boolean |
equals(Object obj)
|
Filter.Result |
filter(LogEvent event)
Context Filter method. |
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)
Appender Filter method. |
Filter.Result |
filter(Logger logger,
org.apache.logging.log4j.Level level,
org.apache.logging.log4j.Marker marker,
Object msg,
Throwable t)
Appender Filter method. |
Filter.Result |
filter(Logger logger,
org.apache.logging.log4j.Level level,
org.apache.logging.log4j.Marker marker,
String msg,
Object... params)
Appender Filter method. |
String |
getKey()
|
Map<String,org.apache.logging.log4j.Level> |
getLevelMap()
|
int |
hashCode()
|
String |
toString()
|
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle |
getState, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop |
createFilter
@PluginFactory
public static DynamicThresholdFilter createFilter(@PluginAttribute(value="key")
String key,
@PluginElement(value="Pairs")
KeyValuePair[] pairs,
@PluginAttribute(value="defaultThreshold")
org.apache.logging.log4j.Level defaultThreshold,
@PluginAttribute(value="onMatch")
Filter.Result onMatch,
@PluginAttribute(value="onMismatch")
Filter.Result onMismatch)
- Create the 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
public boolean equals(Object obj)
- Overrides:
equals
in class Object
filter
public Filter.Result filter(LogEvent event)
- Description copied from class:
AbstractFilter
- Context Filter method. The default returns NEUTRAL.
- Specified by:
filter
in interface Filter
- Overrides:
filter
in class AbstractFilter
- Parameters:
event
- The LogEvent.
- Returns:
- The Result of filtering.
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)
- Description copied from class:
AbstractFilter
- Appender Filter method. The default returns NEUTRAL.
- Specified by:
filter
in interface Filter
- Overrides:
filter
in class AbstractFilter
- 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,
org.apache.logging.log4j.Level level,
org.apache.logging.log4j.Marker marker,
Object msg,
Throwable t)
- Description copied from class:
AbstractFilter
- Appender Filter method. The default returns NEUTRAL.
- Specified by:
filter
in interface Filter
- Overrides:
filter
in class AbstractFilter
- 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,
org.apache.logging.log4j.Level level,
org.apache.logging.log4j.Marker marker,
String msg,
Object... params)
- Description copied from class:
AbstractFilter
- Appender Filter method. The default returns NEUTRAL.
- Specified by:
filter
in interface Filter
- Overrides:
filter
in class AbstractFilter
- 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.
getKey
public String getKey()
getLevelMap
public Map<String,org.apache.logging.log4j.Level> getLevelMap()
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toString
public String toString()
- Overrides:
toString
in class AbstractFilter
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.