[
https://issues.apache.org/jira/browse/LOG4J2-3090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17341672#comment-17341672
]
jasonyu commented on LOG4J2-3090:
---------------------------------
What about using "os.flush()"/"FileDescriptor.sync()" or "FileChannel.force()"
after the "os.write()" in the try block to make sure the .gz file flushed to
the disk?
> Why the log file was deleted when the compressd file has not been flushed to
> the disk?
> --------------------------------------------------------------------------------------
>
> Key: LOG4J2-3090
> URL: https://issues.apache.org/jira/browse/LOG4J2-3090
> Project: Log4j 2
> Issue Type: Question
> Affects Versions: 2.13.3
> Reporter: jasonyu
> Priority: Minor
>
> Here is the situation :
> 1、The appender is RollingFileAppender with SizeBasedTriaggeringPolicy, the
> rolling file pattern is extended to ".gz".
> 2、While the log4j2 executing rolling(compress) event, the linux server is
> rebooted by coincidence.
> As a result, the log file before rolling was deleted and the size of the
> compressed file was zero, which means the log message was lost.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)