org.x4juli.filter
Class LevelMatchFilter

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

public class LevelMatchFilter
extends AbstractFilter

This is a very simple filter based on level matching.

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 Ceki Gülcü. 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 levelToMatch
           
 
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
LevelMatchFilter()
           
 
Method Summary
 int decide(ExtendedLogRecord record)
          Return the decision of this filter.
 boolean getAcceptOnMatch()
           
 java.lang.String getLevelToMatch()
           
 void setAcceptOnMatch(boolean acceptOnMatch)
           
 void setLevelToMatch(java.lang.String level)
           
 
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 true.


levelToMatch

java.util.logging.Level levelToMatch
Constructor Detail

LevelMatchFilter

public LevelMatchFilter()
Method Detail

decide

public int decide(ExtendedLogRecord record)
Return the decision of this filter. Returns ExtendedFilter.DENY if the LevelToMatch option is not set or if there is not match. Otherwise, if there is a match, then the returned decision is ExtendedFilter.ACCEPT if the AcceptOnMatch property is set to true. The returned decision is ExtendedFilter.DENY if the AcceptOnMatch property is set to false.

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)

setLevelToMatch

public void setLevelToMatch(java.lang.String level)
Parameters:
level -
Since:
0.5

getLevelToMatch

public java.lang.String getLevelToMatch()
Returns:
String representation of the level to match
Since:
0.5

setAcceptOnMatch

public void setAcceptOnMatch(boolean acceptOnMatch)
Parameters:
acceptOnMatch -
Since:
0.5

getAcceptOnMatch

public boolean getAcceptOnMatch()
Returns:
whether matches or not
Since:
0.5


${license_html}