phanindra798 commented on code in PR #4473:
URL: https://github.com/apache/logging-log4j2/pull/4473#discussion_r4536383082
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/RollingRandomAccessFileManager.java:
##########
@@ -266,7 +280,9 @@ public static RollingRandomAccessFileManager
getRollingRandomAccessFileManager(
fileGroup,
writeHeader);
rrm.setMaxRandomDelay(data.getMaxRandomDelay());
- if (rrm.isAttributeViewEnabled()) {
+ // A `null` file is not open yet:
`writeToDestination()` opens it on the first write.
+ rrm.truncateOnOpen = raf == null && file != null
&& !append;
+ if (raf != null && rrm.isAttributeViewEnabled()) {
Review Comment:
Added `filePermissionsAreAppliedOnFirstEvent`, which uses `filePermissions`
with `createOnDemand`. It fails without `raf != null`, because
`defineAttributeView` would create the file at startup.
##########
src/changelog/.2.x.x/3083_add_createOnDemand_to_file_appenders.xml:
##########
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entry xmlns="https://logging.apache.org/xml/ns"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ https://logging.apache.org/xml/ns
+ https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
+ type="fixed">
+ <issue id="3083"
link="https://github.com/apache/logging-log4j2/issues/3083"/>
+ <description format="asciidoc">
+ Add the `createOnDemand` attribute to the `RandomAccessFile`,
`RollingRandomAccessFile` and `MemoryMappedFile` appenders, which defers the
creation of the file and its parent directories until the first log event.
Review Comment:
Done, I used your suggested text.
--
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]