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 2020/04/17 23:20:00 UTC

[jira] [Commented] (LOG4J2-2800) Option to flush and rollover active log files on shutdown

    [ https://issues.apache.org/jira/browse/LOG4J2-2800?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17086143#comment-17086143 ] 

Ralph Goers commented on LOG4J2-2800:
-------------------------------------

When Log4j shuts down it calls the stop method on all Appenders. This will close any open files. It will NOT force a rollover as that could violate their triggering policy. We would need an OnShutdownTriggeringPolicy to do that but that would only happen on a graceful shutdown. So in the case where the JVM died or was killed you would still miss the log files since a rollover would not take place.

> Option to flush and rollover active log files on shutdown
> ---------------------------------------------------------
>
>                 Key: LOG4J2-2800
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2800
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Configuration
>    Affects Versions: 2.13.1
>         Environment: * log4j 2.13.1
> * macOS 10.13.6
> * Java 11.0.2
>            Reporter: André Pinto
>            Priority: Major
>
> Even if only programatically, it would be useful to have a way of ensuring all async loggers are flushed and the active log files are rolled over to their final names when using RollingFileAppender.
> The OnStartupTriggeringPolicy does the renaming of the active file on restart, but this doesn't cover the cases of instance termination where there is no subsequent restart. In our case this leads to the active files never being visible to daemon processes responsible for log shipping (which ignore the active filenames).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)