Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
Description
There is a race condition when multiple threads are trying to create the same parent log directory in logback:
java.lang.IllegalStateException: /path/to/log/dir/2010/2010_12/2010_12_08/file.log should not have existing parent directory at ch.qos.logback.core.util.FileUtil.createMissingParentDirectories(FileUtil.java:43) ~[logback-core-0.9.26.jar:na] at ch.qos.logback.core.FileAppender.openFile(FileAppender.java:156) ~[logback-core-0.9.26.jar:na] at ch.qos.logback.core.FileAppender.start(FileAppender.java:115) ~[logback-core-0.9.26.jar:na] [...]
It is completely ok for the check to start if the directory is there and then have the directory appear when we actually come around to creating it. This is because you may have multiple threads wanting to log to the same directory, and if they try to create the dir at the same time one will succeed and one will have it already created. This happens for instance in the case above where a new dir is created at midnight every day, and two threads log at the same time.
Will attach a patch that fixes the problem.