CompositeFilter doesn't work with multiple MarkerFilters
Description
The composite filter seem to not work with multiple MarkerFilters. I learned in the meantime about the existence of the NoMarkerFilter which fits my use case, but I guess chaining multiple MarkerFilters is still a valid scenario.
Here is my configuration:
AppenderRef:
- ref: Console
Filters:
- MarkerFilter:
marker: COMMAND
onMatch: DENY
onMismatch: NEUTRAL
- MarkerFilter:
marker: METRICS
onMatch: DENY
onMismatch: NEUTRAL
You can see in the logs bellow, having two MarkerFIlters, COMMAND and METRICS, only the first one is taken into account.
Configuration
Version: 2.24.1
Operating system: Ubuntu 22.04
JDK: 8
Logs
2024-10-17T12:26:13,119 [main] INFO MarkerExample - This is a METRICS log entry
2024-10-17T12:26:13,122 [main] INFO MarkerExample - This is a general log entry without a marker
Reproduction
I'm attaching a test below demo.zip
The YAML configuration format interprets arrays as a list of element having the same plugin type as the key of the array. Translated to XML your example looks like:
<AppenderRef ref="CONSOLE">
<Filters>
<MarkerFilter marker="COMMAND" onMatch="DENY" onMismatch="NEUTRAL"/>
<Filters>
<!-- This element is ignored since there can be only one filter element.
An `ERROR` is logged to the status logger -->
<Filters>
<MarkerFilter marker="METRICS" onMatch="DENY" onMismatch="NEUTRAL"/>
<Filters>
</AppenderRef>
What you want is for your Filters YAML object to contain an array with key MarkerFilter:
AppenderRef:
ref: CONSOLE
Filters:
MarkerFilter:
- marker: COMMAND
onMatch: DENY
onMismatch: NEUTRAL
- marker: METRICS
onMatch: DENY
onMismatch: NEUTRAL
See Configuration syntax for more details about YAML configuration files. There is a tip about YAML arrays.
Thanks for the detailed explanation. In the documentation this is not so clear. Maybe a clear example would help there.