@Plugin(name="LevelRangeFilter", category="Core", elementType="filter", printObject=true) public final class LevelRangeFilter extends AbstractFilter
onMatch
result if the level in the LogEvent
is in the range of the configured
min and max levels, otherwise it returns onMismatch
value . For example, if the filter is configured with
Level.ERROR
and Level.INFO
and the LogEvent contains Level.WARN
then the onMatch value will
be returned since WARN
events are in between ERROR
and INFO
.
The default Levels are both ERROR
.
Filter.Result
LifeCycle.State
onMatch, onMismatch
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
ELEMENT_TYPE
Modifier and Type | Method and Description |
---|---|
static LevelRangeFilter |
createFilter(Level minLevel,
Level maxLevel,
Filter.Result match,
Filter.Result mismatch)
Create a ThresholdFilter.
|
Filter.Result |
filter(LogEvent event)
Context Filter method.
|
Filter.Result |
filter(Logger logger,
Level level,
Marker marker,
Message msg,
Throwable t)
Appender Filter method.
|
Filter.Result |
filter(Logger logger,
Level level,
Marker marker,
Object msg,
Throwable t)
Appender Filter method.
|
Filter.Result |
filter(Logger logger,
Level level,
Marker marker,
String msg,
Object... params)
Appender Filter method.
|
Level |
getMinLevel() |
String |
toString() |
equalsImpl, filter, filter, filter, filter, filter, filter, filter, filter, filter, filter, getOnMatch, getOnMismatch, hashCodeImpl
getState, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop, stop, stop
@PluginFactory public static LevelRangeFilter createFilter(@PluginAttribute(value="minLevel") Level minLevel, @PluginAttribute(value="maxLevel") Level maxLevel, @PluginAttribute(value="onMatch") Filter.Result match, @PluginAttribute(value="onMismatch") Filter.Result mismatch)
minLevel
- The minimum log Level.maxLevel
- The maximum log Level.match
- The action to take on a match.mismatch
- The action to take on a mismatch.public Filter.Result filter(LogEvent event)
AbstractFilter
filter
in interface Filter
filter
in class AbstractFilter
event
- The LogEvent.public Filter.Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t)
AbstractFilter
filter
in interface Filter
filter
in class AbstractFilter
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.t
- A throwable or null.public Filter.Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t)
AbstractFilter
filter
in interface Filter
filter
in class AbstractFilter
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.t
- A throwable or null.public Filter.Result filter(Logger logger, Level level, Marker marker, String msg, Object... params)
AbstractFilter
filter
in interface Filter
filter
in class AbstractFilter
logger
- the Logger.level
- The logging Level.marker
- The Marker, if any.msg
- The message, if present.params
- An array of parameters or null.public Level getMinLevel()
public String toString()
toString
in class AbstractFilter
Copyright © 1999-2021 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.