DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28647>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28647


[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




------- Additional Comments From [EMAIL PROTECTED]  2007-01-29 11:55 -------

I think what should be supported is to enhance WriterAppender so that subclasses
can specify the flushing behavior.  I don't think it's generally a good idea to
code in the policy itself, but it seems fair to allow users to easily extend
existing classes to get the behavior they want.

I thought of adding an Interface, such as "FlushPolicy" but it seemed like 
overkill.

I propose the following change:
 
Index: C:/src/workspace/log4j/src/java/org/apache/log4j/WriterAppender.java
===================================================================
--- C:/src/workspace/log4j/src/java/org/apache/log4j/WriterAppender.java
(revision 500611)
+++ C:/src/workspace/log4j/src/java/org/apache/log4j/WriterAppender.java
(working copy)
@@ -372,7 +372,7 @@
         }
       }
 
-      if (this.immediateFlush) {
+      if (shouldFlush(event)) {
         this.qw.flush();
       }
   }
@@ -426,6 +426,15 @@
       }
     }
   }
+  
+  /**
+   * Returns true if an event should be flushed immediately.
+   * This method returns the value of [EMAIL PROTECTED] #immediateFlush}.
+   * Subclasses override this behavior to flush only when certain events occur.
+   */
+  protected boolean shouldFlush(LoggingEvent event) {
+    return this.immediateFlush;
+  }
 
 
 }

 
 }

In response to #15, adding a separate API to "flush" appenders really is a
separate issue that should be raised in a different bug.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to