I've got the following lines in my log that I want to exclude, so I wanted to use a RegexFilter to do so:
[INFO ] 2018-05-20 14:52:15.993 [qtp22844606-20] TimingFilter -
Request time: 16 ms
[INFO ] 2018-05-20 14:52:18.998 [qtp22844606-17] TimingFilter -
Request time: 15 ms
[INFO ] 2018-05-20 14:52:22.001 [qtp22844606-20] TimingFilter -
Request time: 0 ms
[INFO ] 2018-05-20 14:52:24.992 [qtp22844606-17] TimingFilter -
Request time: 0 ms
My config looks as such:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<RegexFilter regex=".*TimingFilter.*" useRawMsg="true" onMatch="DENY" onMismatch="ACCEPT"/>
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n" />
</Console>
</Appenders>
<Loggers>
<Root level="info" additivity="false">
<appender-ref ref="console" />
</Root>
</Loggers>
</Configuration>
When switching "ACCEPT" and "DENY" no message gets through, so the RegexFilter per se seems to get picked up. I also tried "\bTimingFilter\b", ".*\bTimingFilter\b.*" without success.
I'm using Log4J 2.11.
Can you give any hints what I do wrong? I checked all other RegexFilter related questions here and also other sites (that's where I got the suggestions for the Regex Patterns I tried), but nothing seems to work.
I also checked the patterns on https://regex101.com/ against my log and there they matched correctly.