[SOLVED] How to check MQTT connection logs?

Well, I’m back after a while to this project.
Now I’m in trouble with a specific and a bit more general question which are connected somehow.

First, I’m trying to use some ESP2866 DIY device with OH and its embedded MQTT. The problem here is that my ESPs randomly gets disconnected from the MQTT server. This can be in 10 minutes or 30 or whatever. The result code on my client’s side is -2 which according to some internet research is probably a not unique client ID. I have currently two test clients and I can confirm their IDs are different. So I would liket to see the OH’s MQTT logs to see if the connection is arrived there at all or where is the problem.

For this I would like to see its logs but I cannot see any - probably debug - log regarding client connection.

I’ve tried karaf console but here comes the general question too.
If I enter log:get I can see the current logging settings. There are a lot of loggers which an amatour like me cannot understand at all. How do I know if I need someting to increase its loglevel what is its name? Where can I find information what are the possible loggers I can add/set here?

And back to my original question:
I found this thread. However it is for the old MQTT if I am right. Anyway I tried it but I still cannot see any MQTT connection related log.

Please direct me to the right way in this topic.

Thanks in advance!

Bonus question: when I have finished debugging is there an easy way to simply reset the logging levels to their factory value? Or if according to the above link I enter log:set DEBUG org.eclipse.paho.client.mqttv3 then a new entry will appear which was not there before. How do I know what was its default value?

In case anyone is interested in similar…

I searched for the installed packages:

sudo apt list --installed | grep openhab


openhab2/stable,now 2.4.0-1 all [installed]
openhab2-addons/stable,now 2.4.0-1 all [installed]
openhab2-addons-legacy/stable,now 2.4.0-1 all [installed]

(Also tried searching for mqtt and moquette but no result.)
Good. Let’s find their files which are related to mqtt and/or moquette:

locate openhab2

Damn! locate is not installed.

-bash: locate: command not found

Let’s install it:

sudo apt update
sudo apt install mlocate

Update the DB:

sudo updatedb

(More information)

Let’s try again:

locate openhab2


locate openhab2-addons


locate openhab2-addons-legacy

Wow! Tons of results. Let’s filter:

locate openhab2 | grep moquette
locate openhab2 | grep mqtt

From the results I found some interesting path like:


enter karaf console and set log to DEBUG for org.eclipse.osgi
Still no connection information. Go again:
I checked the available path and found something related to embedded mqtt broker:


Lets add:

log:set DEBUG org.eclipse.smarthome.io.mqttembeddedbroker


2019-09-30 21:56:29.015 [DEBUG] [r.internal.EmbeddedBrokerServiceImpl] - Connected clients: embedded-mqtt-broker, MasterBedRoom2, test-client

Thats not all. I’m still looking more logs. But this is the way I found. Probably not the best and easyest way so my question is still open:

How can I find what are the possible entries I can set in logs?

If you know please let me know!

Is that a possibility for you too:

Got to the Karaf Console:

openhab-cli console

then type in:

 bundle:list -s | grep -i mqtt

and the result will look like:

This is exactly what I was looking for! Thanks a lot!

I tried using the embedded broker, but preferred to install my own stand alone Mosquitto broker.

I use mosquito only too, as I came from mqtt1. So no need to install others. But thats all the bundles started by OH.

Basically all of you who sais the embedded broker has tons of bugs are right. However I believe in the future of the embedded broker and as this is a pilot system what I use for learning I like to use it. We will see if it grows up.