openHAB 3: conditional log Items

I want to skip the logging for some items like Spotify track progress (which updates every second) so that the logs are not polluted.

Since openHAB version 3 log4j2 is used as logging framework and the log4j2.xml has to be used to configure logging. We can use a RegexFilter to configure such behaviour.

How to

The RegexFilter allows the formatted or unformatted message to be compared against a regular expression.

https://logging.apache.org/log4j/2.x/manual/filters.html

The config file for logging is located in the userdata/etc folder (manual setup) or in /var/lib/openhab/etc (apt/deb-based setup).

Locate the Event Log Appender and add a RegexFilter. I added filters for Spotify, CPU load changes and heart beats.

The changes are automatically picked up by openhab without restart. After some seconds those events should not be logged anymore.

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Spelling error report

The following text will be sent to our editors: