[ https://issues.apache.org/jira/browse/LOG4J2-2931?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17825999#comment-17825999 ]
Jörg Delker commented on LOG4J2-2931: ------------------------------------- After 3,5 years passed, I would like to give this a ping. As there is no workaround to the problem - but obviously a rather simple solution - I would kindly ask to have this fixed in the next upcoming version. Thanks. > Configuring CompositeFilter via properties will generate error due to invalid > arguments > --------------------------------------------------------------------------------------- > > Key: LOG4J2-2931 > URL: https://issues.apache.org/jira/browse/LOG4J2-2931 > Project: Log4j 2 > Issue Type: Improvement > Components: Core > Affects Versions: 2.13.3 > Reporter: Oliver Limberg > Priority: Minor > Attachments: CompositeFilterPropertiesTest.java, > log4j2-composite-filter.properties > > > The attached test will produce the following errors: > {noformat} > ERROR filters contains invalid attributes "onMatch", "onMismatch" > ERROR filters contains invalid attributes "onMatch", "onMismatch" > {noformat} > When the configuration is built, using DefaultConfigurationBuilder, filters > are always built using the class DefaultFilterComponentBuilder. > The constructor will always add the two attributes 'onMatch' and > 'onMismatch'. > However, the createFilters method (annotated with PluginFactory) of > CompositeFilter, does not specify the two attributes, so they remain in the > list of node attributes in PluginBuilder and when calling > checkForRemainingAttributes, the error statements are generated. > A simple solution could be to change the signature of createFilters to > include those two attributes. The constructor of the CompositeFilter could > stay untouched. > {code:java} > @PluginFactory > public static CompositeFilter createFilters(@PluginElement("Filters") final > Filter[] filters, > @PluginAttribute("onMatch") final > Result match, > @PluginAttribute("onMismatch") > final Result mismatch) { > return new CompositeFilter(filters); > }{code} > This solution would required to make a minor change in addFilter of class > AbstractFilterable and its test class. > Another solution would be to modify the DefaultFilterComponentBuilder or > even use DefaultCompositeFilterComponentBuilder when applicable in > DefaultConfigurationBuilder. -- This message was sent by Atlassian Jira (v8.20.10#820010)