- Main Page
- Modules
- Namespaces
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ExpressionFilter Class Reference

Inherits Filter.

List of all members.

## Detailed Description

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.

NOTE: Grouping using parentheses is supported - all tokens must be separated by spaces, and operands which contain spaces are not yet supported.

Example:

In order to build a filter that displays all messages with infomsg-45 or infomsg-44 in the message, as well as all messages with a level of WARN or higher, build an expression using the LikeRule (supports ORO-based regular expressions) and the InequalityRule. ( MSG LIKE infomsg-4[4,5] ) && ( LEVEL >= WARN )

Three options are required: Expression - the expression to match ConvertInFixToPostFix - convert from infix to posfix (default true) AcceptOnMatch - true or false (default true)

Meaning of AcceptToMatch: If there is a match between the value of the Expression option and the log4cxx::spi::LoggingEvent and AcceptOnMatch is true, the decide method returns log4cxx::spi::Filter#ACCEPT.

If there is a match between the value of the Expression option and the log4cxx::spi::LoggingEvent and AcceptOnMatch is false, log4cxx::spi::Filter#DENY is returned.

If there is no match, log4cxx::spi::Filter#NEUTRAL is returned.

## Public Member Functions

| ExpressionFilter ()
void | activateOptions (log4cxx::helpers::Pool &p)
| Usually filters options become active when set.
void | setExpression (const LogString &expression)
LogString | getExpression () const
void | setConvertInFixToPostFix (bool convertInFixToPostFix)
bool | getConvertInFixToPostFix () const
void | setAcceptOnMatch (bool acceptOnMatch)
bool | getAcceptOnMatch () const
FilterDecision | decide (const spi::LoggingEventPtr &event) const
| Returns log4cxx::spi::Filter#NEUTRAL is there is no string match.

## Constructor & Destructor Documentation

ExpressionFilter | ( |  | ) |

## Member Function Documentation

void activateOptions | ( | log4cxx::helpers::Pool & | p | ) | `[virtual]`

| Usually filters options become active when set. We provide a default do-nothing implementation for convenience. Reimplemented from Filter.

FilterDecision decide | ( | const spi::LoggingEventPtr & | event | ) | const`[virtual]`

| Returns log4cxx::spi::Filter#NEUTRAL is there is no string match. Implements Filter.

bool getAcceptOnMatch | ( |  | ) | const

bool getConvertInFixToPostFix | ( |  | ) | const

LogString getExpression | ( |  | ) | const

void setAcceptOnMatch | ( | bool | acceptOnMatch | ) |

void setConvertInFixToPostFix | ( | bool | convertInFixToPostFix | ) |

void setExpression | ( | const LogString & | expression | ) |

The documentation for this class was generated from the following file:

- expressionfilter.h