Class ExpressionFilter
java.lang.Object
org.apache.log4j.spi.Filter
org.apache.log4j.filter.ExpressionFilter
- All Implemented Interfaces:
org.apache.log4j.spi.OptionHandler
public class ExpressionFilter
extends org.apache.log4j.spi.Filter
A filter supporting complex expressions - supports both infix and postfix
expressions (infix expressions must first be converted to postfix prior
to processing).
See org.apache.log4j.chainsaw.LoggingEventFieldResolver.java
for the correct names for logging event fields
used when building expressions.
See org.apache.log4j.chainsaw.rule package
for a list of available
rules which can be applied using the expression syntax.
See org.apache.log4j.chainsaw.RuleFactory for the symbols
used to activate the corresponding rules.
LoggingEvent and AcceptOnMatch is true,
the decide(LoggingEvent) method returns Filter.ACCEPT.
If there is a match between the value of the
Expression option and the LoggingEvent and AcceptOnMatch is false,
Filter.DENY is returned.
If there is no match, Filter.NEUTRAL is returned.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleanaccept on match.(package private) booleanConvert in-fix to post-fix.(package private) StringExpression.(package private) RuleEvaluated rule.Fields inherited from class org.apache.log4j.spi.Filter
ACCEPT, DENY, NEUTRAL, next -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidintdecide(org.apache.log4j.spi.LoggingEvent event) Determines if event matches the filter.booleanGets whether filter accepts matching or non-matching events.booleanGet in-fix to post-fix conversion setting.Get expression.voidsetAcceptOnMatch(boolean newValue) Set whether filter should accept events if they match the expression.voidsetConvertInFixToPostFix(boolean newValue) Set convert in-fix to post-fix.voidsetExpression(String exp) Set exp.Methods inherited from class org.apache.log4j.spi.Filter
getNext, setNext
-
Field Details
-
Constructor Details
-
ExpressionFilter
public ExpressionFilter()
-
-
Method Details
-
activateOptions
public void activateOptions()- Specified by:
activateOptionsin interfaceorg.apache.log4j.spi.OptionHandler- Overrides:
activateOptionsin classorg.apache.log4j.spi.Filter
-
setExpression
-
getExpression
-
setConvertInFixToPostFix
public void setConvertInFixToPostFix(boolean newValue) Set convert in-fix to post-fix.- Parameters:
newValue- new value.
-
getConvertInFixToPostFix
public boolean getConvertInFixToPostFix()Get in-fix to post-fix conversion setting.- Returns:
- true if in-fix expressions are converted to post-fix.
-
setAcceptOnMatch
public void setAcceptOnMatch(boolean newValue) Set whether filter should accept events if they match the expression.- Parameters:
newValue- if true, accept on match.
-
getAcceptOnMatch
public boolean getAcceptOnMatch()Gets whether filter accepts matching or non-matching events.- Returns:
- if true, accept matching events.
-
decide
public int decide(org.apache.log4j.spi.LoggingEvent event) Determines if event matches the filter.- Specified by:
decidein classorg.apache.log4j.spi.Filter- Parameters:
event- logging event;- Returns:
Filter.NEUTRALis there is no string match.
-