tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: svn commit: r898745 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/juli/FileHandler.java webapps/docs/logging.xml
Date Wed, 13 Jan 2010 15:09:23 GMT
-1, I would propose this one to be

writer.write(result);
if (bufferSize < 0)
     flush();


Here is why

1. No synchronized(this) - not sure why we think its needed
2. It allows a setting of bufferSize==0 -> use system default
3. bufferSize<0 do a flush of the writer

best
Filip


On 01/13/2010 06:28 AM, jim@apache.org wrote:
> Author: jim
> Date: Wed Jan 13 13:28:54 2010
> New Revision: 898745
>
> URL: http://svn.apache.org/viewvc?rev=898745&view=rev
> Log:
> Merge r897380, r897381 from trunk:
>
> Followup for r816252/r891328
> Allow to disable buffering in JULI FileHandler
> The previous implementation did not work as expected because of buffering performed by
OutputStreamWriter
>
> Update documentation
> Submitted by: kkolinko
> Reviewed/backported by: jim
>
> Modified:
>      tomcat/tc6.0.x/trunk/STATUS.txt
>      tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java
>      tomcat/tc6.0.x/trunk/webapps/docs/logging.xml
>
> Modified: tomcat/tc6.0.x/trunk/STATUS.txt
> URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=898745&r1=898744&r2=898745&view=diff
> ==============================================================================
> --- tomcat/tc6.0.x/trunk/STATUS.txt (original)
> +++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Jan 13 13:28:54 2010
> @@ -28,13 +28,6 @@
>   PATCHES ACCEPTED TO BACKPORT:
>     [ start all new proposals below, under PATCHES PROPOSED. ]
>
> -* Allow to disable buffering in JULI FileHandler
> -  It is followup to r891328,
> -  which failed to implement this fix properly.
> -  http://svn.apache.org/viewvc?rev=897380&view=rev  (fix)
> -  http://svn.apache.org/viewvc?rev=897381&view=rev  (Documentation)
> -  +1: kkolinko, markt, rjung, jim
> -  -1:
>
>   PATCHES PROPOSED TO BACKPORT:
>     [ New proposals should be added at the end of the list ]
>
> Modified: tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java
> URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java?rev=898745&r1=898744&r2=898745&view=diff
> ==============================================================================
> --- tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java (original)
> +++ tomcat/tc6.0.x/trunk/java/org/apache/juli/FileHandler.java Wed Jan 13 13:28:54 2010
> @@ -144,7 +144,16 @@
>           try {
>               PrintWriter writer = this.writer;
>               if (writer!=null) {
> -                writer.write(result);
> +                if (bufferSize>  0) {
> +                    writer.write(result);
> +                } else {
> +                    synchronized (this) {
> +                        // OutputStreamWriter performs buffering inside its StreamEncoder,
> +                        // and so to run without a buffer we have to flush explicitly
> +                        writer.write(result);
> +                        writer.flush();
> +                    }
> +                }
>               } else {
>                   reportError("FileHandler is closed or not yet initialized, unable to
log ["+result+"]", null, ErrorManager.WRITE_FAILURE);
>               }
>
> Modified: tomcat/tc6.0.x/trunk/webapps/docs/logging.xml
> URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/logging.xml?rev=898745&r1=898744&r2=898745&view=diff
> ==============================================================================
> --- tomcat/tc6.0.x/trunk/webapps/docs/logging.xml (original)
> +++ tomcat/tc6.0.x/trunk/webapps/docs/logging.xml Wed Jan 13 13:28:54 2010
> @@ -129,9 +129,10 @@
>         <li>The root logger can define its set of handlers using a
>         <code>.handlers</code>  property.</li>
>         <li>Logging is buffered using a default buffer size of 8192 bytes.
> -      To change buffersize, use the<code>bufferSize</code>  property.</li>
> -<li>System property replacement for property values which start with
> -      ${systemPropertyName}.</li>
> +      To change buffersize, use the<code>bufferSize</code>  property of
a handler.
> +      The value of<code>0</code>  disables buffering.</li>
> +<li>System property replacement is performed for property values which
> +      contain ${systemPropertyName}.</li>
>       </ul>
>     </p>
>     <p>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message