logging-log4j2 icon indicating copy to clipboard operation
logging-log4j2 copied to clipboard

RollingFileAppender with createOnDemand="true" eagerly tries creating directories

Open isaac-s opened this issue 1 year ago • 0 comments

Description

When specifying createOnDemand="true" on a RollingFileAppender, the expectation is that the file won't be created before the appender is actually used.

However, while there is no attempt to create the logging file, Log4J2 still tries to create the file's directory:

https://github.com/apache/logging-log4j2/blob/main/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingFileManager.java#L769

Configuration

Version: 2.20.0

Operating system: Windows 11

JDK: Oracle Java 17.0.3

isaac-s avatar Nov 26 '23 17:11 isaac-s