public class

StringMatchFilter

extends Filter
java.lang.Object
   ↳ org.apache.log4j.spi.Filter
     ↳ org.apache.log4j.varia.StringMatchFilter

Class Overview

This is a very simple filter based on string matching.

The filter admits two options StringToMatch and AcceptOnMatch. If there is a match between the value of the StringToMatch option and the message of the LoggingEvent, then the decide(LoggingEvent) method returns ACCEPT if the AcceptOnMatch option value is true, if it is false then DENY is returned. If there is no match, NEUTRAL is returned.

Summary

Constants
String ACCEPT_ON_MATCH_OPTION This constant is deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.
String STRING_TO_MATCH_OPTION This constant is deprecated. Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.
[Expand]
Inherited Constants
From class org.apache.log4j.spi.Filter
[Expand]
Inherited Fields
From class org.apache.log4j.spi.Filter
Public Constructors
StringMatchFilter()
Public Methods
int decide(LoggingEvent event)
Returns NEUTRAL is there is no string match.
boolean getAcceptOnMatch()
String[] getOptionStrings()
This method is deprecated. We now use JavaBeans introspection to configure components. Options strings are no longer needed.
String getStringToMatch()
void setAcceptOnMatch(boolean acceptOnMatch)
void setOption(String key, String value)
This method is deprecated. Use the setter method for the option directly instead of the generic setOption method.
void setStringToMatch(String s)
[Expand]
Inherited Methods
From class org.apache.log4j.spi.Filter
From class java.lang.Object
From interface org.apache.log4j.spi.OptionHandler

Constants

public static final String ACCEPT_ON_MATCH_OPTION

This constant is deprecated.
Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

Constant Value: "AcceptOnMatch"

public static final String STRING_TO_MATCH_OPTION

This constant is deprecated.
Options are now handled using the JavaBeans paradigm. This constant is not longer needed and will be removed in the near term.

Constant Value: "StringToMatch"

Public Constructors

public StringMatchFilter ()

Public Methods

public int decide (LoggingEvent event)

Returns NEUTRAL is there is no string match.

Parameters
event The LoggingEvent to decide upon.
Returns
  • decision The decision of the filter.

public boolean getAcceptOnMatch ()

public String[] getOptionStrings ()

This method is deprecated.
We now use JavaBeans introspection to configure components. Options strings are no longer needed.

public String getStringToMatch ()

public void setAcceptOnMatch (boolean acceptOnMatch)

public void setOption (String key, String value)

This method is deprecated.
Use the setter method for the option directly instead of the generic setOption method.

public void setStringToMatch (String s)