Return-Path: Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: (qmail 18946 invoked from network); 11 Oct 2009 02:54:10 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Oct 2009 02:54:10 -0000 Received: (qmail 74619 invoked by uid 500); 11 Oct 2009 02:54:10 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 74537 invoked by uid 500); 11 Oct 2009 02:54:10 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 74528 invoked by uid 500); 11 Oct 2009 02:54:10 -0000 Received: (qmail 74525 invoked by uid 99); 11 Oct 2009 02:54:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Oct 2009 02:54:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Oct 2009 02:54:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 13CB923888EA; Sun, 11 Oct 2009 02:53:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r824003 - in /logging/log4j/trunk/src: changes/changes.xml main/java/org/apache/log4j/WriterAppender.java Date: Sun, 11 Oct 2009 02:53:45 -0000 To: log4j-cvs@logging.apache.org From: carnold@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091011025346.13CB923888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: carnold Date: Sun Oct 11 02:53:45 2009 New Revision: 824003 URL: http://svn.apache.org/viewvc?rev=824003&view=rev Log: Bug 28647: Allow overriding of flush strategy Modified: logging/log4j/trunk/src/changes/changes.xml logging/log4j/trunk/src/main/java/org/apache/log4j/WriterAppender.java Modified: logging/log4j/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/changes/changes.xml?rev=824003&r1=824002&r2=824003&view=diff ============================================================================== --- logging/log4j/trunk/src/changes/changes.xml (original) +++ logging/log4j/trunk/src/changes/changes.xml Sun Oct 11 02:53:45 2009 @@ -87,6 +87,7 @@ More Debug output for log4j auto-configure requested. Add MDC.clear(). NullPointerException when calling Category.removeAllAppenders(). + Allow overridding of flush strategy. Modified: logging/log4j/trunk/src/main/java/org/apache/log4j/WriterAppender.java URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/main/java/org/apache/log4j/WriterAppender.java?rev=824003&r1=824002&r2=824003&view=diff ============================================================================== --- logging/log4j/trunk/src/main/java/org/apache/log4j/WriterAppender.java (original) +++ logging/log4j/trunk/src/main/java/org/apache/log4j/WriterAppender.java Sun Oct 11 02:53:45 2009 @@ -38,7 +38,8 @@ /** Immediate flush means that the underlying writer or output stream - will be flushed at the end of each append operation. Immediate + will be flushed at the end of each append operation unless shouldFlush() + is overridden. Immediate flush is slower but ensures that each append request is actually written. If immediateFlush is set to false, then there is a good chance that the last few @@ -315,7 +316,7 @@ } } - if(this.immediateFlush) { + if(shouldFlush(event)) { this.qw.flush(); } } @@ -369,4 +370,14 @@ this.qw.write(h); } } + + /** + * Determines whether the writer should be flushed after + * this event is written. + * + * @since 1.2.16 + */ + protected boolean shouldFlush(final LoggingEvent event) { + return immediateFlush(); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org For additional commands, e-mail: log4j-dev-help@logging.apache.org