Starting Mosquitto in verbose/debug mode through /etc/init.d/mosquitto

5,379 views
Skip to first unread message

GeertVc

unread,
Aug 28, 2015, 5:01:57 AM8/28/15
to MQTT
I've installed Mosquitto on my Raspberry Pi through sudo apt-get install mosquitto mosquitto-clients python-mosquitto.
Thanks to the last part, python-mosquitto, I'm able to start/stop/restart/... Mosquitto through sudo /etc/init.d/mosquitto [start|stop|status|restart|...], which is nice.
However, I can also start Mosquitto "manually" with the verbose option through sudo mosquitto -v.

I would also like to have the chance to start Mosquitto in verbose and/or debug mode through the sudo /etc/init.d/mosquitto ... command.  I was thinking of adding this option into the /etc/mosquitto/mosquitto.conf file, but I can't find the right syntax and I'm also not sure if that's possible at all.  I tried to add verbose true into the configuration file (like there is persistence true, among others) in different flavours, but none of them is picked up correctly.

Is it possible through the configuration file and if so, how?

nemik

unread,
Aug 28, 2015, 10:36:30 AM8/28/15
to MQTT
/etc/init.d forks processes so you won't see things like the verbose output, that's usually only for debugging. You might get close by trying "tail -f /var/log/mosquitto/mosquitto.log"

GeertVc

unread,
Aug 28, 2015, 1:35:01 PM8/28/15
to MQTT
I tried this already before, but I don't get the output I see when I start Mosquitto "by hand" from the command line by adding the option -v.

If it's not possible, then I'll continue using the manual method....

Karl Palsson

unread,
Aug 28, 2015, 5:32:21 PM8/28/15
to mq...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Maybe just try reading the mosquitto.conf file a bit better....

There's a whole series of log_xxxx options you should have seen if you
had looked at the file. Or the documentation for the file...
http://mosquitto.org/man/mosquitto-conf-5.html

Cheers,
Karl P

GeertVc <geert.vanc...@gmail.com> wrote:
> I tried this already before, but I don't get the output I see when I
> start
> Mosquitto "by hand" from the command line by adding the option -v.
>
> If it's not possible, then I'll continue using the manual method....
>
> On Friday, August 28, 2015 at 4:36:30 PM UTC+2, nemik wrote:
> >
> > /etc/init.d forks processes so you won't see things like the verbose
> > output, that's usually only for debugging. You might get close by trying
> > "tail -f /var/log/mosquitto/mosquitto.log"
> >
> > On Friday, August 28, 2015 at 4:01:57 AM UTC-5, GeertVc wrote:
> >>
> >> I've installed Mosquitto on my Raspberry Pi through *sudo apt-get
> >> install mosquitto mosquitto-clients python-mosquitto*.
> >> Thanks to the last part, python-mosquitto, I'm able to
> >> start/stop/restart/... Mosquitto through *sudo /etc/init.d/mosquitto
> >> [start|stop|status|restart|...]*, which is nice.
> >> However, I can also start Mosquitto "manually" with the verbose option
> >> through *sudo mosquitto -v*.
> >>
> >> I would also like to have the chance to start Mosquitto in verbose and/or
> >> debug mode through the *sudo /etc/init.d/mosquitto ...* command. I was
> >> thinking of adding this option into the */etc/mosquitto/mosquitto.conf*
> >> file, but I can't find the right syntax and I'm also not sure if that's
> >> possible at all. I tried to add *verbose true* into the configuration
> >> file (like there is *persistence true*, among others) in different
> >> flavours, but none of them is picked up correctly.
> >>
> >> Is it possible through the configuration file and if so, how?
> >>
> >>
>

- --
Sent using Mailpile, Free Software from www.mailpile.is

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJV4NMkAAoJEBmotQ/U1cr2ovEP+weYMDiQVQK9y4p8hshH3zn1
1O6/Ib9qC0O9+2aVwlWN7IMo5CzEajwufPK+jhfTW73dl7FD/GiThta9jkmFpRfn
A8jk6sfabx+MTjmF6h0n9jyMzX/xLnWZBIpu5b4z2OhaPnDw63lzqYnVRdcFzLzM
IkZVn4yFVUARchGbNNKJ97VuoAOnut8pFB6hNHiuUHgAxMeiY9YzAIDTN/DCSBkv
GGZbJYevp0EjDxc9eBWOkDJOoq6RtruQphQjzPkdeYTTwBTfvl8TlsUPJ6TOhS5F
sXAZcqHxo+k/moEK9LFrV2bgrrnHtu1BxcpOwNzP2E4nMZcJ1p6eBB+GiKY3ffZj
sgHSim+Fnoc3LaYzHzRsDh1jhlvhH2R+ESwEl8nHpRIdxl+fOWwk/qg0rHna0b4V
C/8TmUopLGK5ZPhxYpwFu0m2adDhpB/VIvTaWsDp2Bw27brlHHiEF3dV86AcTK2C
UBKcPhX0uL35IRn6OUQngEN9zY1LyW+Vxi3I8J3Jz1qMSXL2/i5MniV0WA2JnOUc
CnIwPcV6htA5wqnDyBFKr5Z5Qk1Szo27/xeEdqLenWjaoHABAlMsVZjDIL9KcHXp
7vTeaMU31mgXvyJi+1MliDkr3AhuD1MlAvCqS8W5ZJ35/x4BSLkxpV4bI/EKZRle
yZ7tfhuhPxCSXuF0XNeJ
=nj4v
-----END PGP SIGNATURE-----

GeertVc

unread,
Aug 29, 2015, 2:57:17 AM8/29/15
to MQTT
@karlp: Rest assured, I did read the mosquitto.conf file which was put on my Raspberry Pi after installing Mosquitto.  And the "whole series of log_xxxx options" you're pointing at in your reply-with-a-slightly-arrogant-undertone boils down to, right, simply just one log_xxxx line.  So, a bit exaggerated, isn't it???

Here's the full content of the mosquitto.conf file as it appears just after a fresh Mosquitto installation on the RPi:

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d


But I must admit, I didn't read the man page thoroughly enough.  And even better, you indirectly pointed me to the example mosquitto.conf file in /usr/share/doc/mosquitto/examples/, where I also found the solution to my problem.

Just in case other people face the same issue and because I like to help people if I found something useful for myself, here's the adapted mosquitto.conf file, which gives me at least the information I would see if I start Mosquitto manually with the -v option:

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

# Added by GVC
log_type all
# End by GVC


log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d


I only added one line, log_type all, which gave me the information I wanted to see appearing in the log file.  I "spy" the log file using the command tail -f /var/log/mosquitto/mosquitto.log.  Finetuning might still be needed, depending on one's needs, though...

To be complete, I also added the example mosquitto.conf file to this thread.

mosquitto.conf
Reply all
Reply to author
Forward
0 new messages