Using CompositeFilter on appender with properties configuration

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Using CompositeFilter on appender with properties configuration

Oliver Limberg
Hi,

I am trying to configure a RegexFilter and and ThresholdFilter together on
an appender.
According to the documentation this should be pretty simple for XML
configuration.
However, the project currently uses the properties format and the example
does not contain the usage of CompositeFilter.
Hier are various attempts I tried:

appender.console.type = Console
appender.console.name = Console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = ${log4j2.out.pattern}
appender.console.filter.c.type = CompositeFilter
appender.console.filter.c.regex.type = RegexFilter
appender.console.filter.c.regex.regex = expected resource not found:
/META-INF/javamail.default.(providers|address.map)
appender.console.filter.c.regex.onMatch = DENY
appender.console.filter.c.threshold.type = ThresholdFilter
appender.console.filter.c.threshold.level = WARN

appender.console.type = Console
appender.console.name = Console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = ${log4j2.out.pattern}
appender.console.filters.c.type = CompositeFilter
appender.console.filters.c.filter.regex.type = RegexFilter
appender.console.filters.c.filter.regex.regex = expected resource not
found: /META-INF/javamail.default.(providers|address.map)
appender.console.filters.c.filter.regex.onMatch = DENY
appender.console.filters.c.filter.threshold.type = ThresholdFilter
appender.console.filters.c.filter.threshold.level = WARN

appender.console.type = Console
appender.console.name = Console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = ${log4j2.out.pattern}
appender.console.filters.regex.type = RegexFilter
appender.console.filters.regex.regex = expected resource not found:
/META-INF/javamail.default.(providers|address.map)
appender.console.filters.regex.onMatch = DENY
appender.console.filters.threshold.type = ThresholdFilter
appender.console.filters.threshold.level = WARN


Looking at the source code, the keyword filters is only allowed at top
level and expects a comma separated lists of values.
But what should you put as values? Further more, as far as I understood,
those filters will be context-wide filters and will not be passed to the
loggers in case of a DENY.
I also tried to configure the single filter on an appender as
CompositeFilter and then add the specific filters to it, but this did not
work either. So any help would be appreciated.

Regards
Oliver