Separate zWave log file?

I found the posting by @rlkoshak (Taming openHAB 2 Logging) and updated org.ops4j.pax.logging.cfg adding the logger and the appender,

# zwave logger = TRACE, zwave, osgi:* = false

# File appender - zwave.log
log4j.appender.zwave.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-26.26c{1}] - %m%n

Restarted openhab… And… nothing…

I realise that the post is old (Last year), but it does say it was updated… And it appears to be consistent with the wording in the openhab2 logging page (

zWave still logs with everything else into openhab.log and events.log. I’ve also tried to set zWave logging to DEBUG in the console (After eventually finding and then working out it needs to be run as openhab, not as root because it doesn’t work when started as root)…

But nothing on the logging side changed…

openhab> set LEVEL DEBUG org.openhab.binding.zwave

I think I’m losing my marbles here. Certainly the will to live… 2.2.0-1 appears to be anything but stable for me. And trying to determine why is driving me nuts.

Hmm… Because the docs are wrong?

The config file actually uses log4j2… e.g.

# OSGi appender
log4j2.appender.osgi.type = PaxOsgi = OSGI
log4j2.appender.osgi.filter = *

Changing the logger and appender to use the same… And it’s no longer ignored… But still doesn’t work… I now have a new error on startup in the console…

penhab@piman-202:~$ /usr/share/openhab2/
Launching the openHAB runtime...
Listening for transport dt_socket at address: 5005
13:58:22.989 [CM Configuration Updater (ManagedService Update: pid=[org.ops4j.pax.logging])] ERROR org.apache.felix.configadmin - [org.osgi.service.log.LogService, org.knopflerfish.service.log.LogService, org.ops4j.pax.logging.PaxLoggingService,, id=33, bundle=6/mvn:org.ops4j.pax.logging/pax-logging-log4j2/1.10.1]: Unexpected problem updating configuration org.ops4j.pax.logging
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring( [?:?]
	at org.apache.logging.log4j.util.PropertiesUtil.partitionOnCommonPrefixes( [5:org.ops4j.pax.logging.pax-logging-api:1.10.1]
	at [6:org.ops4j.pax.logging.pax-logging-log4j2:1.10.1]
	at [6:org.ops4j.pax.logging.pax-logging-log4j2:1.10.1]
	at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.doUpdate( [6:org.ops4j.pax.logging.pax-logging-log4j2:1.10.1]
	at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl.updated( [6:org.ops4j.pax.logging.pax-logging-log4j2:1.10.1]
	at org.ops4j.pax.logging.log4j2.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated( [6:org.ops4j.pax.logging.pax-logging-log4j2:1.10.1]
	at [7:org.apache.felix.configadmin:1.8.16]
	at [7:org.apache.felix.configadmin:1.8.16]
	at [7:org.apache.felix.configadmin:1.8.16]
	at$ManagedServiceUpdate.provide( [7:org.apache.felix.configadmin:1.8.16]
	at$ [7:org.apache.felix.configadmin:1.8.16]
	at [7:org.apache.felix.configadmin:1.8.16]
	at [7:org.apache.felix.configadmin:1.8.16]
	at [?:?]

                          __  _____    ____
  ____  ____  ___  ____  / / / /   |  / __ )
 / __ \/ __ \/ _ \/ __ \/ /_/ / /| | / __  |
/ /_/ / /_/ /  __/ / / / __  / ___ |/ /_/ /
\____/ .___/\___/_/ /_/_/ /_/_/  |_/_____/
    /_/                        2.2.0
                               Release Build

Well, the docs are not really wrong but outdated. Until oh2.1 log4j was used and the docs are ok for this.

With the introduction of oh2.2 logging was changed to log4j2 as you already noticed.

A nice example how to configure it can be found here Log4j2 Sample Config

# zwave = org.openhab.binding.zwave
log4j2.logger.zwave.level = TRACE
log4j2.logger.zwave.additivity = false
log4j2.logger.zwave.appenderRefs = zwave
log4j2.logger.zwave.appenderRef.zwave.ref = zwave = zwave
log4j2.appender.zwave.type = RollingRandomAccessFile
log4j2.appender.zwave.fileName = /var/log/openhab2/zwave.log
log4j2.appender.zwave.filePattern = /var/log/openhab2/zwave.log.%i
log4j2.appender.zwave.immediateFlush = true
log4j2.appender.zwave.append = true
log4j2.appender.zwave.layout.type = PatternLayout
log4j2.appender.zwave.layout.pattern = %d{dd-MMM-yyyy HH:mm:ss.SSS} [%-5.5p] [%-50.50c] - %m%n
log4j2.appender.zwave.policies.type = Policies
log4j2.appender.zwave.policies.size.type = SizeBasedTriggeringPolicy
log4j2.appender.zwave.policies.size.size = 1000MB
log4j2.appender.zwave.strategy.type = DefaultRolloverStrategy

Thanks @sipvoip. That worked and now I can get the zWave logs for the issues.

The description in the Admin Guide here didn’t work for me, but thanks to the example here it works now (zwave written in small letters). Thanks! :grinning: