Logging of dependency libraries

Hey All,

As some may have seen, I’m working on a binding for roborock vacuums. Right now, I’m only supporting cloud connections via the roborock mqtt servers.

Things initially work with status updates and commands both working. After some time, the status updates stop working, whilst mqtt seems to remain connected. (ie publishing commands still works, and running tcpdump on port 8883 generates enough incoming traffic to suggest that messages are still being received, but not being handled (for whatever reason).

I’m interested in seeing any logging from hivemq. I ran ‘openhab-cli console’ and used:

log:set TRACE com.hivemq.client.mqtt

To set the logging for hivemq - but nothing appears in openhab.log and I don’t see the output anywhere else?

Is it indeed possible to generate logging for the dependency libraries?

Cheers,

Paul

Double check if logging configuration permits trace logs to reach file. Sometimes appender may be set to ignore levels below certain threshold.
Within karaf/openhab shell you may try doing log:tail to tap it via embedded appender which retains entries only in memory and have no filters.

Hi Paul,

Great work on the Roborock binding — very cool project!

Regarding your issue with logging the HiveMQ MQTT client, you’re on the right track using:

bash

CopyEdit

log:set TRACE com.hivemq.client.mqtt

However, in many OpenHAB deployments, especially if you’re using the bundled HiveMQ client through the org.openhab.core.io.transport.mqtt module, the logging class might need to be more specific.

Try setting the TRACE log level for the following packages as well:

pgsql

CopyEdit

log:set TRACE org.openhab.core.io.transport.mqtt
log:set TRACE com.hivemq
log:set TRACE com.hivemq.client.internal

Also, ensure that the logs aren’t being filtered or redirected. You can verify by checking:

  • userdata/logs/openhab.log
  • userdata/logs/events.log
  • Or by watching live output with log:tail in the console.

If that still doesn’t give results, it could be that HiveMQ uses SLF4J and the logging backend isn’t hooked properly for the client logs. In that case, you might need to explicitly configure log4j2.xml under userdata/etc/ to include those packages with TRACE level.

Let me know if that helps — happy to dig deeper with you!

Cheers,

Thanks folks, I’ll try some of these ideas this evening.

Looks like hivemq natively uses Logback by default - Logging · hivemq/hivemq-community-edition Wiki · GitHub

1 Like

That’s a wiki about their broker which we don’t use. We use their MQTT client which uses SLF4J when available:

1 Like

Thanks Wouter, should SLF4J be available by default?

I’m loading it at https://github.com/psmedley/openhab-addons/blob/roborock/bundles/org.openhab.binding.roborock/src/main/java/org/openhab/binding/roborock/internal/RoborockAccountHandler.java#L60

1 Like

I think I’ve tried all this to no avail. log4j2.xml has the hivemq entries after configuration by the gui, log:tail in the console doesn’t show anything, and there are no references to hivemq in any logs on /var/log/openhab/*.log

FYI my roborock binding isn’t using org.openhab.core.io.transport.mqtt, it’s using hivemq directly.

1 Like

The logging probably works fine. However there doesn’t seem to be much trace/debug logging, see:

https://github.com/hivemq/hivemq-mqtt-client/issues/411

logger usages:

1 Like

I’m not seeing ANY logging from hivemq…

Did you read the links? It only logs errors or warnings.

I had a better read now on the laptop, was looking on the phone earlier. Given the problems I’m seeing, I’m still surprised there is nothing from hivemq :frowning:

You could also enable logging for the OH MQTT transport which may help with debugging issues:

org.openhab.core.io.transport.mqtt

Thanks Wouter - I enabled org.openhab.core.io.transport.mqtt but still no mqtt logging. I guess I need to try run the binding under a debugger - new territory for me with java apps.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.