org.x4juli.filter
Class LevelRangeFilter

java.lang.Object
  extended byorg.x4juli.global.components.AbstractComponent
      extended byorg.x4juli.global.components.AbstractFilter
          extended byorg.x4juli.filter.LevelRangeFilter
All Implemented Interfaces:
Component, ExtendedFilter, java.util.logging.Filter, OptionHandler

public class LevelRangeFilter
extends AbstractFilter

This is a very simple filter based on level matching, which can be used to reject messages with priorities outside a certain range.

Logging API as a whole was originally done for Apache log4j. Juli is a port of main parts of that to complete the Java Logging APIs. All credits for initial idea, design, implementation, documentation belong to the log4j crew. This file was originally published by Simon Kitching. Please use exclusively the appropriate mailing lists for questions, remarks and contribution.

Since:
0.5
Author:
Boris Unckel

Field Summary
(package private)  boolean acceptOnMatch
          Do we return ACCEPT when a match occurs.
(package private)  java.util.logging.Level levelMax
           
(package private)  java.util.logging.Level levelMin
           
 
Fields inherited from class org.x4juli.global.components.AbstractFilter
 
Fields inherited from class org.x4juli.global.components.AbstractComponent
manager, repository
 
Fields inherited from interface org.x4juli.global.spi.ExtendedFilter
ACCEPT, DENY, X4JULI_ACCEPT, X4JULI_DENY, X4JULI_NEUTRAL
 
Constructor Summary
LevelRangeFilter()
           
 
Method Summary
 int decide(ExtendedLogRecord record)
           If the decision is DENY, then the event will be dropped.
 boolean getAcceptOnMatch()
          Get the value of the AcceptOnMatch option.
 java.util.logging.Level getLevelMax()
          Get the value of the LevelMax option.
 java.util.logging.Level getLevelMin()
          Get the value of the LevelMin option.
private static boolean isGreaterOrEqual(java.util.logging.Level left, java.util.logging.Level right)
           
 void setAcceptOnMatch(boolean acceptOnMatch)
          Set the AcceptOnMatch option.
 void setLevelMax(java.util.logging.Level levelMax)
          Set the LevelMax option.
 void setLevelMin(java.util.logging.Level levelMin)
          Set the LevelMin option.
 
Methods inherited from class org.x4juli.global.components.AbstractFilter
activateOptions, getNext, isLoggable, setNext
 
Methods inherited from class org.x4juli.global.components.AbstractComponent
getLogger, getLoggerRepository, getMessageProperties, getNonFloodingLogger, getProperty, getProperty, getProperty, getProperty, resetErrorCount, setObjectStore
 
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

java.util.logging.Level levelMin

levelMax

java.util.logging.Level levelMax
Constructor Detail

LevelRangeFilter

public LevelRangeFilter()
Method Detail

decide

public int decide(ExtendedLogRecord record)
Description copied from class: AbstractFilter

If the decision is DENY, then the event will be dropped. If the decision is NEUTRAL, then the next filter, if any, will be invoked. If the decision is ACCEPT then the event will be logged without consulting with other filters in the chain.

Specified by:
decide in interface ExtendedFilter
Specified by:
decide in class AbstractFilter
Parameters:
record - The LoggingEvent to decide upon.
Since:
0.5
See Also:
AbstractFilter.decide(org.x4juli.global.spi.ExtendedLogRecord)

getLevelMax

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

Since:
0.5

getLevelMin

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

Since:
0.5

getAcceptOnMatch

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

Since:
0.5

setLevelMax

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

Since:
0.5

setLevelMin

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

Since:
0.5

setAcceptOnMatch

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

Since:
0.5

isGreaterOrEqual

private static boolean isGreaterOrEqual(java.util.logging.Level left,
                                        java.util.logging.Level right)


${license_html}