LevelMatchFilter

Use LevelMatchFilter when you want to filter log events for a single message threshold. For example, you might want to log only error messages, or you might want all messages that do not have a threshold of FATAL.

Syntax

<filter class="LevelMatchFilter">
<param name="LevelToMatch" value="DEBUG | TRACE | INFO | WARN | ERROR | FATAL"/>
<param name="AcceptOnMatch" value="TRUE | FALSE"/>
</filter>

Syntax Description

class="LevelMatchFilter"
specifies to filter messages based on a log event threshold.
name="AcceptOnMatch" value="TRUE | FALSE"
specifies whether to accept or deny the log event if the log event threshold matches the value in this filter. Valid values are TRUE or FALSE:
TRUE
specifies to accept the log event.
FALSE
specifies to deny the log event.
name="LevelToMatch" value="DEBUG | TRACE | INFO | WARN | ERROR | FATAL"
specifies the threshold to filter log events for this appender. Valid values are DEBUG, TRACE, INFO, WARN, ERROR, or FATAL.
See Logging Thresholds

Details

To use this filter you specify a threshold, and you specify whether to accept or deny the log event if the filter threshold matches the log event threshold. If there is no match, the filtering process continues with the next filter in the filtering policy. If there are no other filters in the filtering policy and if the log event has not been denied, the appender accepts and processes the log event.

Example

The following filter denies log events whose threshold is INFO:
<filter class="LevelMatchFilter">
   <param name="LevelToMatch" value="info"/>
   <param name="AcceptOnMatch" value="false"/>
</filter>