Logging reduced in Openhab3

Objective: extend potential lifetime of SDHC-card by reducing logging

You may skip this paragraph: In Openhab2 I used this topic Log4j2 Sample Config as my starting point to reduce logging. Just migrated to Openhab3 I realize that I could not use the example of org.ops4j.pax.logging.cfg any more and tried to find a new one. I read this document “Logging in openHAB” but missed the hand holding example for NOOBS and most likely missed newer topics with the new OH3 solution.

Platform information:

  • Release = Raspbian GNU/Linux 10 (buster)
  • Kernel = Linux 5.10.17-v7l+
  • Platform = Raspberry Pi 4 Model B Rev 1.1
  • Openhab(ian) version: 3.0.2 - Release Build

So here come the potential stupid question. Is it as easy as adding into the file:

/var/lib/openhab/etc/log4j2.xml

the following line in the openHAB specific logger configuration section:

<Logger level="WARN" name="openhab.event.ItemStateChangedEvent"/>

to exclude all Item changes from logging?

No. Don’t mess with config files for logging.
Define what to log at which level using log:set in the console.

3 Likes

Ok, Clear, Thanks

Not so familiar with the console and had to tackle two hurdles to reach this console again but the guiding was good and the document “Logging in openHAB” now makes more sense :wink:

f.y.i. RSA-key and changed default password

As you use openHABian, make sure to use the builtin functionality (normally via menu but some via /etc/openhabian.conf on install such as “adminkeyurl” or “debugmode”) for all those tasks rather than to change config files yourself (and potentially break openHABian with that).