logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Flushing FileAppender explicitly
Date Sat, 23 Mar 2013 22:27:05 GMT
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-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message