How to add Regex Filter to log4j2.xml

Hey,
How to add regex filter to new filesystem for logging conf?

I found on internet something like this:

<RegexFilter regex=".* modbus_reset_switch .*" onMatch="DENY" onMismatch="ACCEPT"/>

but it is not working.

What I try to do is filter logs to be without:

2020-12-05 02:02:37.878 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'modbus_reset_switch' received command ON

If you do not want…

org.eclipse.smarthome.event.ItemCommandEvent

… in your events.log, then set the log level to WARN or OFF from the Karaf console…

log:set WARN org.eclipse.smarthome.event.ItemCommandEvent

You can find more detail in the documentation…

I dont want to turn everything off. I only want to disable this particular log entry. Only for modbus_reset_switch

In your regex you have spaces around the item name, perhaps that is the reason it does not match?

I checked it, and nothing.
First I got without spaces, but in here they have spaces:

@Kamil_Matuszczak Did you figure this out? Need to filter out some event-spam

[EDIT] Found it here
and run systemctl restart openhab.service

1 Like