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 !!

1 Like

@BobA,

Quick question. The item ‘command’ is currently storing the last keypad command (e.g. arm/disarm code). Obviously that makes sense but would it possible to have the item not store the value (perhaps a parameter) ? I’m currently not storing the user codes anywhere on OH (I’ll supply the arm/disarm code using a token via the OH3 Rest/API) so this would be ideal in securing the property.

Thoughts ? Much appreciated !!

Hi. Bindings don’t have direct control over items, but rather communicate with them via channels. I could probably modify the binding so that the keypad thing optionally sends an empty string back on the command channel after receiving a command, but that would be unusual behavior. It may be better to just write an empty string or an invalid command like “X” to the item state after sending a command when you think it contains something that you may not want exposed (e.g. your arm code).

You can probably also use the expire parameter to automatically update the state of the item after you’ve sent a command. Maybe try something like { expire="30s,state=X" }. See Items | openHAB.

You may also be able to mess with the autoupdate parameter so that the item state won’t be updated when you send a command via an item. See Items | openHAB. Note that sending a command via an item and updating the item state are actually distinct actions.

2 Likes

Your response is very much appreciated. I went ahead and added the following which the keypad appears to be happy with.

{channel="alarmdecoder:keypad:adp1:6160:command", expire="1s,state=****"}

10:48:03.053 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'AD_Keypad_Command' received command 12342
10:48:03.088 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'AD_Keypad_Command' predicted to become ****

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.