Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win10 mosquitto logfile #1880

Closed
J1EXA opened this issue Nov 6, 2020 · 18 comments
Closed

Win10 mosquitto logfile #1880

J1EXA opened this issue Nov 6, 2020 · 18 comments

Comments

@J1EXA
Copy link

J1EXA commented Nov 6, 2020

mosquitto broker installed as a service.
mosquitto.conf > log_dest file c:\mosquitto\log\mosquitto.log
mosquitto broker service doesn't started
if mosquitto.conf > #log_dest file c:\mosquitto\log\mosquitto.log
the service starts OK

@richlgit
Copy link

richlgit commented Nov 7, 2020

I'm assuming you created c:\mosquitto. Given that, does the Windows account that the service is running under have WRITE permissions to c:\mosquitto\log? (Usually the SYSTEM account by default I believe)

@J1EXA
Copy link
Author

J1EXA commented Nov 7, 2020

changing folder attributes doesn't help.

@EnneiteZer
Copy link

Hi,

same issue here, but starting mosquitto in command line.

mosquitto.exe -c mosquitto.conf

crashes if in mosquitto.conf :
log_dest file c:\mosquitto\log\mosquitto.log

@richlgit
Copy link

richlgit commented Nov 9, 2020

If you performed a stock windows setup then the installation directory should be 'c:\Program Files\mosquitto'. Is that where your installation is? If so, have you tried this in the config file: 'log_dest file c:\program files\mosquitto\mosquitto.log'?

@EnneiteZer
Copy link

Yes, my bad, the installation is in c:\Program Files\mosquitto, and i have setup 'log_dest file c:\program files\mosquitto\mosquitto.log' in mosquitto.conf. It was just a bad copy/paste with the previous post.

@richlgit
Copy link

richlgit commented Nov 9, 2020

Thanks EnneiteZer. When you say it 'crashes' while starting from the command line, what indications / error messages do you see?

You could try starting it without the '-c mosquitto.conf' switch. (It should be the same as that's the default)

You could try starting with a new/fresh/clean/stock/default mosquitto.conf file just to make sure a non-printable character wasn't accidentally saved in your config file.

@richlgit
Copy link

richlgit commented Nov 9, 2020

Also, EnneiteZer,

  1. I'm assuming that mosquitto.log doesn't exist already. If it does you could try deleting or renaming it first in case there's a problem with the log file itself.

  2. I'm assuming that you're performing these attempts in a cmd window as an administrator....

  3. Your example above doesn't show any quote marks around the log file path, but that's what tripped me up when I first installed it. It doesn't want any quotes. ;)

@richlgit
Copy link

J1EXA, EnneiteZer: Did either of you resolve this?
If so, I'd love to hear about it and learn from your experience.
TIA.

@richlgit
Copy link

Awfully quiet. ;)

Behavior has changed. I upgraded my Windows binary install from 1.6.10a to 1.6.12a and see the same issues as J1EXA, EnneiteZer. Tried everything I can think of to work around this to no avail, all from the command line. Note that starting with a config file which stipulates 'log_dest stdout' works fine and log output is visible, but not being able to log to a file is still a showstopper, especially when running as a service.

@J1EXA
Copy link
Author

J1EXA commented Nov 12, 2020

I can't overcome this problem

@EnneiteZer
Copy link

Hi, richlgit, sorry for my (very) late response, I haven't found time to try more things.
But when I posted my message, I have really tried everything you mentioned and more ! Works fine with log_dest stdout, it's really with the file that there is a problem. Nothing I can do more that I'm thinking of :/

@richlgit
Copy link

Until they get around to a fix, let me know if either of you would like a copy of the Windows 64bit binary installer (mosquitto-1.6.10a-install-windows-x64) and I'll put it out there where you can download it. It doesn't have the log file issue.

@J1EXA
Copy link
Author

J1EXA commented Nov 14, 2020

Until they get around to a fix, let me know if either of you would like a copy of the Windows 64bit binary installer (mosquitto-1.6.10a-install-windows-x64) and I'll put it out there where you can download it. It doesn't have the log file issue.

I will be very grateful for the file

@richlgit
Copy link

https://1drv.ms/u/s!ArRoE3jgqIuQpcF8nmypE0wLMcSFug?e=v1NJ90
Don’t forget to run uninstall.exe first, and extra credit for a reboot after that. 😉

Also, note, for reasons I don’t understand (Windows updates?) I now have to comment out these two lines in my config file whereas I didn’t before. (Scratches head):
#persistence true
#persistent_client_expiration 7d

@richlgit
Copy link

Oh, and you probably already know all this, but FWIW: As installed, the mosquitto.log file permissions don't allow your console user to view the file. Running this script will allow you to view it. Note, there's an assumption that your install directory is c:\program files\mosquitto, and that you're running in CMD window with administrative rights.

@Echo off
takeown /f "c:\Program Files\Mosquitto\Mosquitto.log"
icacls "c:\Program Files\Mosquitto\Mosquitto.log" /grant %UserName%:F

@J1EXA
Copy link
Author

J1EXA commented Nov 15, 2020

https://1drv.ms/u/s!ArRoE3jgqIuQpcF8nmypE0wLMcSFug?e=v1NJ90
Don’t forget to run uninstall.exe first, and extra credit for a reboot after that. 😉

Also, note, for reasons I don’t understand (Windows updates?) I now have to comment out these two lines in my config file whereas I didn’t before. (Scratches head):
#persistence true
#persistent_client_expiration 7d

yes, thank you, the service is working and the log is being written.

ralight added a commit that referenced this issue Nov 17, 2020
Closes #1880. Thanks to J1EXA, richl, and EnneiteZer.
@ralight
Copy link
Contributor

ralight commented Nov 17, 2020

Sorry for the delay, I had a load of trouble getting my Windows install up to date.

I think this is now fixed as per the commits above. I've uploaded an installer with that fix in to https://mosquitto.org/files/binary/win64/mosquitto-1.6.12b-install-windows-x64.exe If you could give it a try and report back that would be great.

Note that you can always get the older installers at: https://mosquitto.org/files/binary/

@richlgit
Copy link

No apologies necessary for the delay. You provide stellar service for what your users pay for the application. ;) Also, I can empathize on the Windows updates.

Confirmed that 1.6.12b starts both as a service and via the command line while logging to the specified log_dest file parameter, and I've been able to add the 'persistence' switches back into the conf file without affecting startup.

All is well from my viewpoint. Hopefully J1EXA will be able to try it soon and close the the issue.
I also appreciate the pointer to the prior binaries. I missed that.
Thanks ralight.

fAuernigg pushed a commit to fAuernigg/mosquitto that referenced this issue Nov 17, 2020
Closes eclipse#1880. Thanks to J1EXA, richl, and EnneiteZer.
@ralight ralight closed this as completed in f02c67f Dec 2, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants