Dafengsu opened a new pull request, #986:
URL: https://github.com/apache/logging-log4j2/pull/986
If 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 the first log of each directory try to create, 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
--
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]