LevelRangeFilter

Use LevelRangeFilter when you want to filter log event messages whose message threshold falls within a range of message thresholds.

Syntax

<filter class="LevelRangeFilter">
<param name="LevelMax" value="threshold"/>
<param name="LevelMin" value="threshold"/>
<param name="AcceptOnMatch" value="TRUE | FALSE"/>
</filter>

Syntax Description

class="LevelRangeFilter"
specifies to use the LevelRangeFilter
name="LevelMax" value="threshold"
specifies the highest threshold that can be written to the appender.
name="LevelMin" value="threshold"
specifies the lowest threshold that can be written to the appender.
name="AcceptOnMatch" value="TRUE | FALSE"
specifies whether to accept the log event when the log event message threshold falls within the threshold range that is specified by the filter. Valid values are TRUE or FALSE:
TRUE
specifies to accept the log event.
FALSE
specifies to pass the filtering process to the next filter in the filtering policy. If the log event has not been denied and there are no other filters in the filtering policy, the appender accepts and processes the log event.

Details

The thresholds are, from lowest to highest: TRACE, DEBUG, INFO, WARN, ERROR, and FATAL. For example, if the minimum threshold is DEBUG and the maximum threshold is ERROR, and if AcceptOnMatch is FALSE, messages that have the thresholds TRACE and FATAL are denied.
To use this filter you specify a minimum and a maximum threshold range to compare with the log event threshold. If there is no match, the log event is denied. If there is a match and if AcceptOnMatch is TRUE, the appender accepts and processes the log event. If there is a match and AcceptOnMatch is FALSE, the next filter in the filtering policy is processed. 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 accepts log events only if the log event threshold is between WARN and ERROR:
<filter class="LevelRangeFilter">
   <param name="LevelMax" value="error"/>
   <param name="LevelMin" value="warn"/>
   <param name="AcceptOnMatch" value="true"/>
</filter>