Class LevelRangeFilter
- All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler
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.
- Author:
- Simon Kitching, based on code by Ceki Gülcü
-
Field Summary
Fields inherited from class org.apache.log4j.spi.Filter
ACCEPT, DENY, NEUTRAL, next -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintdecide(org.apache.log4j.spi.LoggingEvent event) Return the decision of this filter.booleanGet the value of theAcceptOnMatchoption.org.apache.log4j.LevelGet the value of theLevelMaxoption.org.apache.log4j.LevelGet the value of theLevelMinoption.voidsetAcceptOnMatch(boolean acceptOnMatch) Set theAcceptOnMatchoption.voidsetLevelMax(org.apache.log4j.Level levelMax) Set theLevelMaxoption.voidsetLevelMin(org.apache.log4j.Level levelMin) Set theLevelMinoption.Methods inherited from class org.apache.log4j.spi.Filter
activateOptions, getNext, setNext
-
Constructor Details
-
LevelRangeFilter
public LevelRangeFilter()
-
-
Method Details
-
decide
public int decide(org.apache.log4j.spi.LoggingEvent event) Return the decision of this filter.- Specified by:
decidein classorg.apache.log4j.spi.Filter
-
getLevelMax
public org.apache.log4j.Level getLevelMax()Get the value of theLevelMaxoption. -
getLevelMin
public org.apache.log4j.Level getLevelMin()Get the value of theLevelMinoption. -
getAcceptOnMatch
public boolean getAcceptOnMatch()Get the value of theAcceptOnMatchoption. -
setLevelMax
public void setLevelMax(org.apache.log4j.Level levelMax) Set theLevelMaxoption. -
setLevelMin
public void setLevelMin(org.apache.log4j.Level levelMin) Set theLevelMinoption. -
setAcceptOnMatch
public void setAcceptOnMatch(boolean acceptOnMatch) Set theAcceptOnMatchoption.
-