Sorry for not responding sooner.  The best way to do this is to use 
Configurator to initialize and shutdown Log4j 2 in your application.  This will 
close the file during shutdown. See 
https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk/web/src/main/java/org/apache/logging/log4j/core/web/Log4jContextListener.java
 for how you can do that in a web application.

Ralph

On Mar 18, 2013, at 10:46 AM, adischlesinger wrote:

> I am using a RollingFileAppender with "immediateFlush" disabled in order to
> optimize speed. Before exiting the application however I would like to flush
> the appender. How can I do this in log4j 2? Prior to this version there was
> the setImmediateFlush method, but now the setting, as far as I managed to
> find out, pertains to a "manager" member which cannot be accessed. The
> RollingFileAppender is also final an cannot be extended. Thanks!
> Adrian
> 
> 
> 
> --
> View this message in context: 
> http://apache-logging.6191.n7.nabble.com/Flushing-FileAppender-explicitly-tp36205.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

Reply via email to