OpenHab event logging more verbose after migrating: Update events logged although no change

After migrating to OpenHab 4 and not changing any log configuration,
I noticed that events.log gets filled up with log entries although there is no real change to the item:

...
2023-08-22 08:21:38.277 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Hobbyraum_BatteryLevel' updated to 1
2023-08-22 08:21:38.278 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Hobbyraum_BatteryLow' updated to ON
..
2023-08-22 08:22:00.235 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Hobbyraum_BatteryLevel' updated to 1
2023-08-22 08:22:00.236 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Hobbyraum_BatteryLow' updated to ON
...

I hadn’t changed any log levels when migrating and log:get shows this:

openhab> log:get openhab.event.ItemStateUpdatedEvent
INFO
openhab> log:get
Logger                                             β”‚ Level
───────────────────────────────────────────────────┼──────
ROOT                                               β”‚ WARN
javax.jmdns                                        β”‚ ERROR
javax.mail                                         β”‚ ERROR
openhab.event                                      β”‚ INFO
openhab.event.AddonEvent                           β”‚ ERROR
openhab.event.ChannelDescriptionChangedEvent       β”‚ ERROR
openhab.event.InboxUpdatedEvent                    β”‚ ERROR
openhab.event.ItemAddedEvent                       β”‚ ERROR
openhab.event.ItemChannelLinkAddedEvent            β”‚ ERROR
openhab.event.ItemChannelLinkRemovedEvent          β”‚ ERROR
openhab.event.ItemRemovedEvent                     β”‚ ERROR
openhab.event.ItemStateEvent                       β”‚ ERROR
openhab.event.RuleAddedEvent                       β”‚ ERROR
openhab.event.RuleRemovedEvent                     β”‚ ERROR
openhab.event.RuleStatusInfoEvent                  β”‚ ERROR
openhab.event.StartlevelEvent                      β”‚ ERROR
openhab.event.ThingAddedEvent                      β”‚ ERROR
openhab.event.ThingRemovedEvent                    β”‚ ERROR
openhab.event.ThingStatusInfoEvent                 β”‚ ERROR
openhab.event.ThingUpdatedEvent                    β”‚ ERROR
org.apache.cxf.jaxrs.sse.SseEventSinkImpl          β”‚ ERROR
org.apache.cxf.phase.PhaseInterceptorChain         β”‚ ERROR
org.apache.karaf.jaas.modules.audit                β”‚ INFO
org.apache.karaf.kar.internal.KarServiceImpl       β”‚ ERROR
org.apache.karaf.shell.ssh.SshUtils                β”‚ ERROR
org.apache.karaf.shell.support                     β”‚ OFF
org.apache.sshd                                    β”‚ WARN
org.eclipse.lsp4j                                  β”‚ OFF
org.jupnp                                          β”‚ ERROR
org.openhab                                        β”‚ INFO
org.ops4j.pax.url.mvn.internal.AetherBasedResolver β”‚ ERROR
org.ops4j.pax.web.pax-web-runtime                  β”‚ OFF
su.litvak.chromecast.api.v2.Channel                β”‚ ERROR

Is there anything I can do about this and reduce the amount of log entries? NB: I’d still like to see any real change of value beeing logged!

May I suggest the change that openhab.event.ItemStateUpdatedEvent events should only be logged at the INFO level when the value has changed and on the DEBUG level otherwise.

(Could this have also been the default behavior of OpenHab 3.4?)

Thanks in advance!

Not really, but anyway: why ? Having that info is good.

Update is an as-important information as is Change, and it would be a fundamental change to adversely affect everybody so … no :slight_smile:

Maybe take a look at this?

1 Like

Thanks Mark,

that helped me to fix it, thanks! - However, to be specific for others with the same problem - here are the detailss what I did manually

 1024 cd /tmp
 1025 wget https://github.com/openhab/openhab-distro/raw/main/distributions/openhab/src/main/resources/userdata/etc/log4j2.xml
 1026 diff /srv/openhab-userdata/etc/log4j2.xml /tmp/log4j2.xml
 1027 cp /srv/openhab-userdata/etc/log4j2.xml /home/openhabian/log4j2.xml.save
 1028 cat /tmp/log4j2.xml > /srv/openhab-userdata/etc/log4j2.xml
 1029 ls -al /srv/openhab-userdata/etc/log4j2.xml /tmp/log4j2.xml
 1030 sudo systemctl restart openhab.service

Result: No more β€œupdate” information with no item change at the INFO level!

BTW: Here’s the diff for userdata/etc/log4j2.xml :

# diff /home/openhabian/log4j2.xml.save /srv/openhab-userdata/etc/log4j2.xml
64a65,66
>               <Logger level="ERROR" name="openhab.event.ItemStateUpdatedEvent"/>
>               <Logger level="ERROR" name="openhab.event.GroupStateUpdatedEvent"/>