You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2021/07/02 03:06:00 UTC

[jira] [Assigned] (LOG4J2-3114) Wrong value "false" of RollingFileAppender.immediateFlush when configured from a Log4j 1.x configuration

     [ https://issues.apache.org/jira/browse/LOG4J2-3114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers reassigned LOG4J2-3114:
-----------------------------------

    Assignee: Ralph Goers

> 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.3.4#803005)