How to Log Debug Z-Wave Messages to Their Own File in OpenHAB 2?

Tags: #<Tag:0x00007f433ce4cc68>

I’m trying to set up a new system with OpenHAB 2. One of the things I found really useful with OpenHAB 1 was logging Debug-level Z-Wave messages, and putting them in a separate file from the rest of OpenHAB’s logging.

I cannot figure out how to do either of those with OpenHAB 2. (I’m not totally sure how its logging can be reconfigured in general.) Can anyone give me some pointers?

http://docs.openhab.org/administration/logging.html#logging-into-a-separate-file

Okay; that helps a lot, but I think I’m still missing something. I’ve got DEBUG Z-Wave output going to a separate file, but it’s also still going to the main openhab.log file, which I don’t want.

Here’s what I added to my /usr/share/openhab2/runtime/karaf/etc/org.ops4j.pax.logging.cfg file:

log4j.logger.org.openhab.binding.zwave = DEBUG, zwave

log4j.appender.zwave=org.apache.log4j.RollingFileAppender
log4j.appender.zwave.layout=org.apache.log4j.PatternLayout
log4j.appender.zwave.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%-5.5p] [%-36.36c] - %m%n
log4j.appender.zwave.file=${openhab.logdir}/zwave.log
log4j.appender.zwave.append=true
log4j.appender.zwave.maxFileSize=10MB
log4j.appender.zwave.maxBackupIndex=10

What do I need to add to prevent Z-Wave logging from clogging up my openhab.log file?

Try adding following statement to the cfg:

log4j.additivity.org.openhab.binding.zwave = false

1 Like

That appears to have taken care of it.

Thanks!

I am aware that this is an old thread, but the way logging should be activated in general for the zwave binding is described here:

http://www.cd-jackson.com/index.php/openhab/5-zwave-debugging-openhab

EDIT: the setting for logging into separate files as described above still applies, though.

1 Like

Nope, logging has changed about six month ago, the above settings/config changes don’t work anymore.
New examples can be found here:

1 Like

@sihui
When I saw the above comment by @stefan.hoehn , I went ahead and followed those instructions, and now I am seeing the zwave debug information in my log file (and Log Viewer). Are the instructions you are pointing to intended to create a separate log file (e.g., for Z-wave log information)?

You can find an example in the zwave binding docs

2 Likes