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
Closed

Windows log file locked which prevents debugging #515

laconical77 opened this issue Aug 11, 2017 · 7 comments

Comments

@laconical77
Copy link

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
Copy link

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

@Nik0902
Copy link

Nik0902 commented Dec 12, 2017

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

@dattatrayam
Copy link

I also have same issue. Please help

@archerian
Copy link

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
Copy link

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
Copy link

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

@GDH-ISIS
Copy link

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 as completed in 2b2afc9 Aug 1, 2019
vankxr pushed a commit to vankxr/mosquitto that referenced this issue Aug 9, 2019
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.
ralight added a commit that referenced this issue Sep 18, 2019
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 #515.
@lock lock bot locked as resolved and limited conversation to collaborators Oct 30, 2019
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

8 participants