Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.log4j.varia
Class LevelRangeFilter  view LevelRangeFilter download LevelRangeFilter.java

java.lang.Object
  extended byorg.apache.log4j.spi.Filter
      extended byorg.apache.log4j.varia.LevelRangeFilter
All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler

public class LevelRangeFilter
extends org.apache.log4j.spi.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 org.apache.log4j.spi.LoggingEvent is not between Min and Max (inclusive), then Filter.DENY>Filter.DENY 55 is returned.

If the Logging event level is within the specified range, then if AcceptOnMatch is true, Filter.ACCEPT>Filter.ACCEPT 55 is returned, and if AcceptOnMatch is false, Filter.NEUTRAL>Filter.NEUTRAL 55 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 55 method available to all appenders extending org.apache.log4j.AppenderSkeleton for a more convenient way to filter out events by level.


Field Summary
(package private)  boolean acceptOnMatch
          Do we return ACCEPT when a match occurs.
(package private)  org.apache.log4j.Level levelMax
           
(package private)  org.apache.log4j.Level levelMin
           
 
Fields inherited from class org.apache.log4j.spi.Filter
ACCEPT, DENY, NEUTRAL, next
 
Constructor Summary
LevelRangeFilter()
           
 
Method Summary
 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.
 
Methods inherited from class org.apache.log4j.spi.Filter
activateOptions, getNext, setNext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

acceptOnMatch

boolean acceptOnMatch
Do we return ACCEPT when a match occurs. Default is false, so that later filters get run by default


levelMin

org.apache.log4j.Level levelMin

levelMax

org.apache.log4j.Level levelMax
Constructor Detail

LevelRangeFilter

public LevelRangeFilter()
Method Detail

decide

public int decide(org.apache.log4j.spi.LoggingEvent event)
Return the decision of this filter.


getLevelMax

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


getLevelMin

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


getAcceptOnMatch

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


setLevelMax

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


setLevelMin

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


setAcceptOnMatch

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