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

Windows log file locked which prevents debugging #515

Closed
laconical77 opened this issue Aug 11, 2017 · 7 comments

Comments

@laconical77
Copy link

commented Aug 11, 2017

Running on Windows 10 interactively, not as a service. Turned on logging parameter as follows:

log_dest file C:\Program Files (x86)\mosquitto\mosquitto.log

Then started mosquitto. Two problems:

  1. The log file is created but cannot be read using notepad whilst mosquitto is running - I get an error: 'the process cannot access the file because it is being used by another process'. This means there is no way to see what mosquitto is currently doing - you have to stop it in order to read the log file it is producing.

  2. After killing mosquitto via CTRL-C, it cannot be started again and prints out the following message:
    'Error: Unable to open log file C:\Program Files (x86)\mosquitto\mosquitto.log for writing'. After I delete the log file manually, mosquitto can be started.

@machliang

This comment has been minimized.

Copy link

commented Nov 21, 2017

I got the same issue, too. Anyone can help?

@Nik0902

This comment has been minimized.

Copy link

commented Dec 12, 2017

I´m having the same issue.
I´m also using log_dest file ..... Any ideas?

@dattatrayam

This comment has been minimized.

Copy link

commented Dec 20, 2017

I also have same issue. Please help

@archerian

This comment has been minimized.

Copy link

commented Dec 20, 2017

You will have to modify the SECURITY_DESCRIPTOR in util_mosq.c to grant relevant access.

For easier access to the log file during testing, I set restrict_read to false in mqtt3_log_init, ie change

config->log_fptr = _mosquitto_fopen(config->log_file, "at", true);

to

config->log_fptr = _mosquitto_fopen(config->log_file, "at", false);

This gives me a 'regular' log file I can tail, open in Notepad and reload etc.

@arstorey

This comment has been minimized.

Copy link

commented Dec 26, 2017

The log file issue was introduced by the fix for CVE-2017-9868 which points out that the mosquitto.db file was being created with world readable permissions. The fix should have applied to the creation of new files only and should not attempt to overwrite the security descriptors of existing files. In fact the patched fails when attempting to open any file in "append" mode (such as the log file) so only the first run succeeds and subsequent runs silently fail.

@tassi-yuzukko

This comment has been minimized.

Copy link

commented Oct 25, 2018

I´m having the same issue.
However, due to security concerns, this will not be fixed. Does that mean ?

@GDH-ISIS

This comment has been minimized.

Copy link

commented Jun 28, 2019

Same for me. Being able to read the file at any time would make things easier.
Also for the file to append entries on mosquitto restart when used via the Windows service.

@ralight ralight closed this in 2b2afc9 Aug 1, 2019

vankxr added a commit to vankxr/mosquitto that referenced this issue Aug 9, 2019

Allow other apps access to log file on Windows.
This change means that users with the appropriate security permissions
can open the log file for reading at the same time that it is being
written.

Closes eclipse#515.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants
You can’t perform that action at this time.