Logging Levels Help

Good morning and Happy Thanksgiving to all. I was hoping for a quick fix to reduce the chatter of the logs in karaf (we have a lot of motion sensors throughout the house). I’ve tried all the usual methods defined here:

Yet, I still see full output of the logs for the alarmdecoder binding.


openhab> log:set OFF org.openhab.binding.alarmdecoder
openhab> log:get org.openhab.binding.alarmdecoder
OFF
openhab>

I verified the symbolic link using this:

openhab> list -s |grep -i alarmdecoder
241 x Active x  80 x 3.1.0                 x org.openhab.binding.alarmdecoder
openhab>

Any help would be greatly appreciated.

If you look at the log entries that offend you, it will also tell you the module they come from. Is it really the binding?

Great question.

08:31:19.612 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AD_Ready' changed from OFF to ON
08:31:21.070 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AD_DenMotion' changed from CLOSED to OPEN
08:31:21.571 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AD_Ready' changed from ON to OFF
08:31:24.036 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AD_DenMotion' changed from OPEN to CLOSED
08:31:24.651 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AD_Ready' changed from OFF to ON
08:31:26.019 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AD_OfficeMotion' changed from CLOSED to OPEN
08:31:26.732 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AD_Ready' changed from ON to OFF
08:31:28.658 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AD_OfficeMotion' changed from OPEN to CLOSED
08:31:29.174 [INFO ] [openhab.event.ItemStateChangedEvent  ] - Item 'AD_Ready' changed from OFF to ON

You probably will not want to suppress every Item. (you might want to turn your binding back on, in case of problems later)

Of interest -

Maybe you want to filter out events with text “Item 'AD_”

1 Like

Hi. Those items state change events in the log don’t come from the binding. They are generated by the framework. If you want to turn off all item state change INFO level events, you can probably do it with something like:

log:set WARN openhab.event

I’m not sure I’d recommend that, though. It could make future debugging difficult. The regex-based filtering that @rossko57 mentions above is probably the way to go.

For the binding itself, you should generally leave logging set at the default, which is INFO. You definitely shouldn’t set it to anything less than WARN, or you won’t see important error messages.

log:set WARN org.openhab.binding.alarmdecoder

@rossko57, thank you for the suggestion and the links which helped me greatly. Marking this as solved. FYI: This is for OH3 (the OH2 solution is very different).

Here’s what I’ve done so others can quickly resolve all the log entries related to my AD_ * items (specifically motion sensors).

[1] Edit the following file (debian): /var/lib/openhab/etc/log4j2.xml
[2] Verify your regex will operate properly here: https://www.freeformatter.com/java-regex-tester.html
[3] Locate the following entry and add the necessary ‘RegexFilter’ element/attributes.

                <Logger additivity="false" level="INFO" name="openhab.event">
                        <AppenderRef ref="EVENT"/>
                        <AppenderRef ref="OSGI"/>

                        <!-- FILTER ALL 'AD_' ITEMS. -->
                        <RegexFilter onMatch="DENY" onMismatch="NEUTRAL" regex=".*(AD_*).*"/>
                </Logger>

@BobA … Amazing binding. I’m in the process of moving away from using the Envisalink binding (OH2 support only) to the AD. I’ve placed an AD2Iot (ESP/AD2USB) along side an Envisalink. Pretty cool so far, although the MQ implementation is a bit slow on toggling the state of a zone (approx. 60s) when other zones are currently faulted.

Take care everyone and thank you !!