public class LevelRangeFilter
extends org.apache.log4j.spi.Filter
The filter admits three options LevelMin, LevelMax and AcceptOnMatch.
If the level of the LoggingEvent is not between Min and Max
(inclusive), then Filter.DENY is returned.
If the Logging event level is within the specified range, then if
AcceptOnMatch is true, Filter.ACCEPT is returned, and if
AcceptOnMatch is false, Filter.NEUTRAL is returned.
If LevelMin is not defined, then there is no
minimum acceptable level (ie a level is never rejected for
being too "low"/unimportant). If LevelMax is not
defined, then there is no maximum acceptable level (ie a
level is never rejected for beeing too "high"/important).
Refer to the setThreshold method
available to all appenders extending AppenderSkeleton for a more convenient way to
filter out events by level.
| Constructor and Description |
|---|
LevelRangeFilter() |
| Modifier and Type | Method and Description |
|---|---|
int |
decide(org.apache.log4j.spi.LoggingEvent event)
Return the decision of this filter.
|
boolean |
getAcceptOnMatch()
Get the value of the
AcceptOnMatch option. |
org.apache.log4j.Level |
getLevelMax()
Get the value of the
LevelMax option. |
org.apache.log4j.Level |
getLevelMin()
Get the value of the
LevelMin option. |
void |
setAcceptOnMatch(boolean acceptOnMatch)
Set the
AcceptOnMatch option. |
void |
setLevelMax(org.apache.log4j.Level levelMax)
Set the
LevelMax option. |
void |
setLevelMin(org.apache.log4j.Level levelMin)
Set the
LevelMin option. |
public int decide(org.apache.log4j.spi.LoggingEvent event)
decide in class org.apache.log4j.spi.Filterpublic org.apache.log4j.Level getLevelMax()
LevelMax option.public org.apache.log4j.Level getLevelMin()
LevelMin option.public boolean getAcceptOnMatch()
AcceptOnMatch option.public void setLevelMax(org.apache.log4j.Level levelMax)
LevelMax option.public void setLevelMin(org.apache.log4j.Level levelMin)
LevelMin option.public void setAcceptOnMatch(boolean acceptOnMatch)
AcceptOnMatch option.Copyright © 2013 The Apache Software Foundation. Licensed under the Apache License, Version 2.0
Apache Extras for Apache log4j, Apache log4j and Apache are trademarks of the Apache Software Foundation.