Log4j Version 1.2.14: Class LevelRangeFilter

Log4j 1.2

Log4j 1.2.14

org.apache.log4j.varia 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), 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 LevelMinw 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ü

 
 
 int
 boolean
 Level
 Level
 void
 void
 void
 
 
 

LevelRangeFilter

public LevelRangeFilter()

decide

public int decide(LoggingEvent event)
Return the decision of this filter.
Overrides:
decide in class Filter
Following copied from class: org.apache.log4j.spi.Filter
Parameters:
event - The LoggingEvent to decide upon.
Returns:
decision The decision of the filter.

getLevelMax

public Level getLevelMax()
Get the value of the LevelMax option.

getLevelMin

public Level getLevelMin()
Get the value of the LevelMin option.

getAcceptOnMatch

public boolean getAcceptOnMatch()
Get the value of the AcceptOnMatch option.

setLevelMax

public void setLevelMax(Level levelMax)
Set the LevelMax option.

setLevelMin

public void setLevelMin(Level levelMin)
Set the LevelMin option.

setAcceptOnMatch

public void setAcceptOnMatch(boolean acceptOnMatch)
Set the AcceptOnMatch option.

Log4j 1.2.14

Copyright 2000-2005 Apache Software Foundation.