Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.18.0, 2.17.2
-
None
-
None
-
None
Description
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:
<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 you create the first log of each directory, console shows;
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