logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 39971] New: - For efficiency, FileAppender should used buffered I/O for default
Date Wed, 05 Jul 2006 20:45:13 GMT
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=39971>.
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=39971

           Summary: For efficiency, FileAppender should used buffered I/O
                    for default
           Product: Log4j
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: eross@m-qube.com


Justification:  Although many log messages are single-line messages, stack
traces and the like may be written with separate Writer.write() commands.

Additionally, buffered I/O and flush per event are not exclusive.

Patch:

Index: src/java/org/apache/log4j/FileAppender.java
===================================================================
--- src/java/org/apache/log4j/FileAppender.java (revision 378432)
+++ src/java/org/apache/log4j/FileAppender.java (working copy)
@@ -44,6 +44,7 @@
    * The default size of the IO buffer.
    */
   private static final int DEFAULT_BUFFER_SIZE = 8 * 1024;
+
   /**
    * Controls whether to append to or truncate an existing file.
    * The default value for this variable is
@@ -60,7 +61,7 @@

   /**
      Do we do bufferedIO? */
-  protected boolean bufferedIO = false;
+  protected boolean bufferedIO = true;

   /**
      The size of the IO buffer. Default is 8K. */
@@ -222,10 +223,6 @@
   */
   public void setBufferedIO(boolean bufferedIO) {
     this.bufferedIO = bufferedIO;
-
-    if (bufferedIO) {
-      immediateFlush = false;
-    }
   }

   /**
@@ -260,14 +257,9 @@
     throws IOException {
     getLogger().debug("setFile called: {}, {}", fileName, append?"true":"false");

-    // It does not make sense to have immediate flush and bufferedIO.
-    if (bufferedIO) {
-      setImmediateFlush(false);
-    }
-
     closeWriter();

-    FileOutputStream ostream = null;
+    FileOutputStream ostream;
     try {
         //
         //   attempt to create file

-- 
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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message