Log4j 1.1.3

org.apache.log4j.varia
Class PriorityMatchFilter

java.lang.Object
  |
  +--org.apache.log4j.spi.Filter
        |
        +--org.apache.log4j.varia.PriorityMatchFilter
All Implemented Interfaces:
OptionHandler

public class PriorityMatchFilter
extends Filter

This is a very simple filter based on priority matching.

The filter admits two options PriorityToMatch and AcceptOnMatch. If there is an exact match between the value of the PriorityToMatch option and the priority of the LoggingEvent, then the decide(org.apache.log4j.spi.LoggingEvent) method returns Filter.ACCEPT in case the AcceptOnMatch option value is set to true, if it is false then Filter.DENY is returned. If there is no match, Filter.NEUTRAL is returned.

See configuration files test11.xml and test12.xml for an example of seeting up a PriorityMatchFilter.

Since:
0.9.1
Author:
Ceki Gülcü

Field Summary
static String ACCEPT_ON_MATCH_OPTION
          Deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.
static String PRIORITY_TO_MATCH_OPTION
          Deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.
 
Fields inherited from class org.apache.log4j.spi.Filter
ACCEPT, DENY, NEUTRAL, next
 
Constructor Summary
PriorityMatchFilter()
           
 
Method Summary
 int decide(LoggingEvent event)
          Return the decision of this filter.
 boolean getAcceptOnMatch()
           
 String[] getOptionStrings()
          Return list of strings that the OptionHandler instance recognizes.
 String getPriorityToMatch()
           
 void setAcceptOnMatch(boolean acceptOnMatch)
           
 void setOption(String key, String value)
          Set option to value.
 void setPriorityToMatch(String priority)
           
 
Methods inherited from class org.apache.log4j.spi.Filter
activateOptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIORITY_TO_MATCH_OPTION

public static final String PRIORITY_TO_MATCH_OPTION
Deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.


ACCEPT_ON_MATCH_OPTION

public static final String ACCEPT_ON_MATCH_OPTION
Deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

Constructor Detail

PriorityMatchFilter

public PriorityMatchFilter()
Method Detail

getOptionStrings

public String[] getOptionStrings()
Deprecated. We now use JavaBeans introspection to configure components.

Description copied from interface: OptionHandler
Return list of strings that the OptionHandler instance recognizes.

setOption

public void setOption(String key,
                      String value)
Deprecated. Use the setter method for the option directly instead of the generic setOption method.

Description copied from interface: OptionHandler
Set option to value.

The handling of each option depends on the OptionHandler instance. Some options may become active immediately whereas other may be activated only when OptionHandler.activateOptions() is called.


setPriorityToMatch

public void setPriorityToMatch(String priority)

getPriorityToMatch

public String getPriorityToMatch()

setAcceptOnMatch

public void setAcceptOnMatch(boolean acceptOnMatch)

getAcceptOnMatch

public boolean getAcceptOnMatch()

decide

public int decide(LoggingEvent event)
Return the decision of this filter. Returns Filter.NEUTRAL if the PriorityToMatch option is not set. Otherwise, the returned decision is defined according to the following table:

Did a priority match occur? AcceptOnMatch setting
TRUE FALSE
TRUE Filter.ACCEPTFilter.DENY
FALSE Filter.DENYFilter.ACCEPT
Filter decision in function of whether a match occured and the AcceptOnMatch settings

Overrides:
decide in class Filter
Following copied from class: org.apache.log4j.spi.Filter
Parameters:
event - The LoggingEvent to decide upon.
decision - The decision of the filter.

Log4j 1.1.3

Please notify me about new log4j releases.