Enable the ability to disable the buffered writer. This does bunch of copying when...
authorfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 17 Sep 2009 16:07:13 +0000 (16:07 +0000)
committerfhanik <fhanik@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 17 Sep 2009 16:07:13 +0000 (16:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@816252 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/juli/FileHandler.java

index 5ef7fd1..2bf222c 100644 (file)
@@ -292,11 +292,11 @@ public class FileHandler
             String pathname = dir.getAbsolutePath() + File.separator +
                 prefix + date + suffix;
             String encoding = getEncoding();
-            OutputStream os = new BufferedOutputStream(new FileOutputStream(
-                    pathname, true),bufferSize);
+            FileOutputStream fos = new FileOutputStream(pathname, true);
+            OutputStream os = bufferSize>0?new BufferedOutputStream(fos,bufferSize):fos;
             writer = new PrintWriter(
                     (encoding != null) ? new OutputStreamWriter(os, encoding)
-                            : new OutputStreamWriter(os), true);
+                                       : new OutputStreamWriter(os), true);
             writer.write(getFormatter().getHead(this));
         } catch (Exception e) {
             reportError(null, e, ErrorManager.OPEN_FAILURE);