[
https://issues.apache.org/jira/browse/LOG4J2-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17446933#comment-17446933
]
ASF subversion and git services commented on LOG4J2-3114:
---------------------------------------------------------
Commit e4658fa6e53d6e9bfc0d2b994d6ed908f5527576 in logging-log4j2's branch
refs/heads/master from Ralph Goers
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=e4658fa ]
Merge branch 'LOG4J2-3114' of https://github.com/bbodnar/logging-log4j2 into
bbodnar-LOG4J2-3114
> Wrong value "false" of RollingFileAppender.immediateFlush when configured
> from a Log4j 1.x configuration
> --------------------------------------------------------------------------------------------------------
>
> Key: LOG4J2-3114
> URL: https://issues.apache.org/jira/browse/LOG4J2-3114
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders
> Affects Versions: 2.14.1
> Reporter: Barnabas Bodnar
> Assignee: Ralph Goers
> Priority: Minor
> Attachments: rolling-file-not-flushed.tgz
>
>
> Unlike the simple FileAppender (both from a Log4j 1.x and 2.x configuration)
> and the RollingFileAppender configured from a 2.x configuration, the property
> "immediateFlush" has the value "false" on RollingFileAppender configured from
> a Log4j 1.x configuration. This leads to apparently not logging into the file
> (the automatic flush occurs only after a high amount of data and respectively
> a long time).
> The code reveals two relevant differences:
> * "immediateFlush" has the fixed default-value "false" in the 1.x
> configuration-flow (see for eg.
> {code:java}
> org.apache.log4j.builders.appender.RollingFileAppenderBuilder.parseAppender(){code}
> , the same as in
> {code:java}
> org.apache.log4j.builders.appender.FileAppenderBuilder.parseAppender(){code}
> ), unlike in the 2.x configuration-flow (
> {code:java}
> org.apache.log4j.core.appender.AbstractOutputStreamAppender.Builder.immediateFlush{code}
> has the default-value "true")
> * the value of "immediateFlush" is taken from
> {code:java}
> !bufferedIo || isImmediateFlush(){code}
> for a FileAppender, which is missing from the RollingFileAppender
>
> To reproduce, build and start the attached demo-application (initializes
> Log4j2 from a Log4j 1.x configuration and prints periodically a log-entry to
> the console, to a FileAppender and to a RollingFileAppender). Execute "tail
> -f" on the file of the simple appender (log.log) and on that of the rolling
> appender (rlog.log) and observe, that logging output doesn't appear on the
> latter, until the application is stopped.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)