Class LevelRangeFilter
- java.lang.Object
-
- org.apache.log4j.spi.Filter
-
- org.apache.log4j.varia.LevelRangeFilter
-
- All Implemented Interfaces:
OptionHandler
public class LevelRangeFilter extends Filter
This is a very simple filter based on level matching, which can be used to reject messages with priorities outside a certain range.The filter admits three options LevelMin, LevelMax and AcceptOnMatch.
If the level of the
LoggingEvent
is not between Min and Max (inclusive), thenFilter.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
w is not defined, then there is no minimum acceptable level (ie a level is never rejected for being too "low"/unimportant). IfLevelMax
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 toall
appenders extendingAppenderSkeleton
for a more convenient way to filter out events by level.- Author:
- Simon Kitching, based on code by Ceki Gülcü
-
-
Constructor Summary
Constructors Constructor Description LevelRangeFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
decide(LoggingEvent event)
Return the decision of this filter.boolean
getAcceptOnMatch()
Get the value of theAcceptOnMatch
option.Level
getLevelMax()
Get the value of theLevelMax
option.Level
getLevelMin()
Get the value of theLevelMin
option.void
setAcceptOnMatch(boolean acceptOnMatch)
Set theAcceptOnMatch
option.void
setLevelMax(Level levelMax)
Set theLevelMax
option.void
setLevelMin(Level levelMin)
Set theLevelMin
option.-
Methods inherited from class org.apache.log4j.spi.Filter
activateOptions, getNext, setNext
-
-
-
-
Method Detail
-
decide
public int decide(LoggingEvent event)
Return the decision of this filter.
-
getLevelMax
public Level getLevelMax()
Get the value of theLevelMax
option.
-
getLevelMin
public Level getLevelMin()
Get the value of theLevelMin
option.
-
getAcceptOnMatch
public boolean getAcceptOnMatch()
Get the value of theAcceptOnMatch
option.
-
setLevelMax
public void setLevelMax(Level levelMax)
Set theLevelMax
option.
-
setLevelMin
public void setLevelMin(Level levelMin)
Set theLevelMin
option.
-
setAcceptOnMatch
public void setAcceptOnMatch(boolean acceptOnMatch)
Set theAcceptOnMatch
option.
-
-