Dafengsu opened a new pull request, #987: URL: https://github.com/apache/logging-log4j2/pull/987
fix [LOG4J2-3565](https://issues.apache.org/jira/browse/LOG4J2-3565) When you want split the log into different directories by period (day, hour, minute, etc.), and use RollingRandomAccessFileAppender with a DirectWrite rollover, the config should be: ``` xml <RollingRandomAccessFile name="RollingFile" filePattern="${baseDir}/%d{s}/%d{s}.log"> <PatternLayout header= "${LOG_HEADER}"> <Pattern>${LOG_PATTERN}</Pattern> </PatternLayout> <Policies> <TimeBasedTriggeringPolicy/> </Policies> </RollingRandomAccessFile> ``` At that time when the first log of each directory try to create, console shows; ``` shell 2022-07-31 03:17:44,009 main ERROR RollingRandomAccessFileManager target/rolling-random-direct-switch-director/%d{s}/%d{s}.log Failed to create file after rollover: java.io.FileNotFoundException: target/rolling-random-direct-switch-director/44/44.log (No such file or directory) java.io.FileNotFoundException: target/rolling-random-direct-switch-director/44/44.log (No such file or directory) ``` Apparently the directory has not been created when the file is creating -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
