Hi, new OH user here.
Was hoping someone could point me in the right direction regarding setting log level for specific packages.
I’ve installed the Yeelight binding and the binding is quite verbose in regard to logging state changes. Ex. for every call to the binding I’m seeing messages similar to these in /var/log/openhab2/openhab.log
:
2017-06-28 22:16:13.204 [INFO ] [yeelight.handler.YeelightHandlerBase] - YeelightStripeHandler: command: ON
2017-06-28 22:16:16.395 [INFO ] [yeelight.handler.YeelightHandlerBase] - YeelightStripeHandler: command: 24
2017-06-28 22:16:16.586 [INFO ] [yeelight.handler.YeelightHandlerBase] - YeelightStripeHandler: command: 24
2017-06-28 22:16:17.413 [INFO ] [yeelight.handler.YeelightHandlerBase] - YeelightStripeHandler: command: OFF
Now, I figured just change the log level of yeelight.handler.YeelightHandlerBase
to WARN right?
Seems like I’m not able to this (probably because I’ve missed something in the docs). What I’ve tried:
In the OH console: log:set WARN yeelight.handler.YeelightHandlerBase
. After doing this, verifying config with:
openhab> log:get yeelight.handler.YeelightHandlerBase
Logger | Level
--------------------------------------------
yeelight.handler.YeelightHandlerBase | WARN
Manually configure log levels in /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg
(even though log:set
seems to to this automatically). My current /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg
:
[21:23:08] openhabian@IoT-OH-host:/usr/share/openhab2/addons$ cat /var/lib/openhab2/etc/org.ops4j.pax.logging.cfg
# Root logger
log4j.rootLogger = WARN, out, osgi:*
log4j.throwableRenderer=org.apache.log4j.OsgiThrowableRenderer
# openHAB specific logger configuration
log4j.logger.smarthome.event = INFO, event, osgi:*
log4j.logger.smarthome.event.ItemStateEvent = ERROR
log4j.logger.smarthome.event.ThingStatusInfoEvent = ERROR
log4j.logger.smarthome.event.InboxUpdatedEvent = ERROR
log4j.additivity.smarthome.event = false
log4j.logger.org.openhab = INFO
log4j.logger.org.eclipse.smarthome = INFO
log4j.logger.org.jupnp = ERROR
log4j.logger.javax.jmdns = ERROR
log4j.logger.org.ops4j.pax.web.service.jetty.internal.JettyServerWrapper = ERROR
log4j.logger.org.apache.karaf.kar.internal.KarServiceImpl = ERROR
log4j.logger.org.apache.aries.spifly = ERROR
# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n
# File appender - openhab.log
log4j.appender.out=org.apache.log4j.RollingFileAppender
log4j.appender.out.layout=org.apache.log4j.PatternLayout
log4j.appender.out.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n
log4j.appender.out.file=${openhab.logdir}/openhab.log
log4j.appender.out.append=true
log4j.appender.out.maxFileSize=10MB
log4j.appender.out.maxBackupIndex=10
# File appender - events.log
log4j.appender.event=org.apache.log4j.RollingFileAppender
log4j.appender.event.layout=org.apache.log4j.PatternLayout
log4j.appender.event.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-26.26c{1}] - %m%n
log4j.appender.event.file=${openhab.logdir}/events.log
log4j.appender.event.append=true
log4j.appender.event.maxFileSize=10MB
log4j.appender.event.maxBackupIndex=10
# Sift appender
log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.sift.key=bundle.name
log4j.appender.sift.default=openhab
log4j.appender.sift.appender=org.apache.log4j.FileAppender
log4j.appender.sift.appender.layout=org.apache.log4j.PatternLayout
log4j.appender.sift.appender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n
log4j.appender.sift.appender.file=${openhab.logdir}/$\\{bundle.name\\}.log
log4j.appender.sift.appender.append=true
# Yeelight
log4j.logger.yeelight.handler.YeelightHandlerBase = WARN
log4j.logger.yeelight.handler.* = WARN
log4j.logger.yeelight.handler = WARN
I’ve also attempted to restart OH using sudo systemctl restart openhab2
Despite my attempts I’m still seeing the log messages in /var/log/openhab2/openhab.log
.
I’m running Openhabian v1.3 (OH2 stable updated recently) on a Raspberry pi model 3b.
Any help much appreciated.