Closed rdbr closed 3 years ago
Maybe it is a different problem.
Could it be a naming conflict if I have two loggers with these names, so the prefix includes a -
:
test-%Y-%m-%d-%N.log
test-test2-%Y-%m-%d-%N.log
During rotation, maybe the wrong file is rotated.
Sorry I've not had any time to look at these issues recently.
But yes, it's definitely possible that one or other of the loggers is picking up those files as its own. I'm not 100% sure, but if you could change the prefixes, to something definitely unambiguous, it should work ok.
There might also be a problem even if that's not the case, I'm not sure if we stat
all the files in the directory regardless of their name - if we do that, then there's a definite race condition.
I'll try to have a look, and hopefully fix that up.
Ok looking at this, for sure it's that the logger for test-%Y-%m-%d-%N.log
is looking for all files starting test-
and ending with .log
, which will include the test-test2
files. If you gave them unique prefixes, eg test-test1
& test-test2
, then this should fix the issue.
Apologies for the delay, I had some personal issues and this project suffered as a result, nothing to do with the project itself at all.
I have been using the rotating file stream for a long time successfully, but I think there is a race condition when files are getting rotated and zipped.
My application crashed with the following error:
Error: EPERM: operation not permitted, stat 'C:\path\to\log\test-2018-04-09.log'
The directory shows that
C:\path\to\log\test-2018-04-09.log.gz
was created successfully and thetest-2018-04-09.log
was deleted. It should not have tried to access the old, deleted, log file.Below is my init code. I didn't receive an error event, it just crashed.