Any way in OH2 to stop every Item State Change being event logged [ItemStateChangedEvent]?

For steady state operation I have no need for event logging and would like to stop it on the PI rather than having this activity burn sd card writes for no reason.

Is there any way to stop these in OH2?
They are marked with the prefix: [ItemStateChangedEvent]

1 Like

Hi @jtmoderate876,

Sure. There are 2 ways to modify logging levels in OH2 (for events or other log types):

  • Via Karaf
  1. Enter in Karaf Console: sudo ssh openhab@localhost -p 8101 with password habopen
  2. Show the current log levels: log:list
  3. Change the smarthome.event to a lower log level (from max to min: TRACE, DEBUG, INFO, WARN, ERROR, FATAL): log:set WARN smarthome.event

OR

  • Via Files
  1. sudo nano /usr/share/openhab2/runtime/karaf/etc/org.ops4j.pax.logging.cfg
  2. set: log4j.logger.smarthome.event = WARN, event, osgi:*

I usually use the first method and I perform this step everytime I upgrade my OH2 snapshot because the logging configuration is overwritten after an upgrade.

For more detailed info, check out @rlkoshak 's excellent post here:

BR,
Dim

9 Likes

@Dim : thank you for exactly what I needed!

And for the link to @rlkoshak 's OH2 logging tutorial - can’t believe I missed that.

Again thanks for the help.

1 Like

thank you, changed
my config at:
/var/lib/openhab2/etc/org.ops4j.pax.logging.cfg

log4j2.logger.events.level = WARN

stopped logging each state change.

Now I got a smartmeter, and I have some Items which I do not want to log, as the consumption of my house.
showing:
2021-10-25 19:47:45.315 [vent.ItemStateChangedEvent] - Verbrauch changed from 3429.2 to 3432.2
2021-10-25 19:47:45.322 [vent.ItemStateChangedEvent] - Bezug changed from 3429.2 to 3432.2

Has anyone an idea how to filter such ItemStateChangedEvents ? I just want to disable the above ones, but others, I want to log as they do now.
thanks, Klaus

did my job with that:

log4j2.appender.event.filter.PV.type = RegexFilter
log4j2.appender.event.filter.PV.regex = .*PV.*|.*WindValue.*|.*SMARTMETER_Current.*|.*Verbrauch.*|.*Bezug.*|.*Energiebezug.*|.*Einspeis.*
log4j2.appender.event.filter.PV.onMatch = DENY
log4j2.appender.event.filter.PV.onMisMatch = ACCEPT

only works for Opehhab2, anyone any idea for Openhab3 ?