logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: BufferSize always the same
Date Thu, 02 Oct 2003 15:10:17 GMT
Well, in Java IO there are buffers and buffers.

Even if you do *not* set the bufferedIO option in FileAppender, that is if 
bufferedIO is set to false, writing to the file is buffered. 
FileOutputStream is buffered.

If you set the bufferedIO option, FileAppender will buffer String (unicode) 
to stream conversions, FileOutputStream will continue to buffer writes to 
physical media.



At 09:26 AM 10/2/2003 -0500, Pascal Rheaume (QC/EMC) wrote:
>Hi,
>
>I'm using a custom FileAppender with buffered io because speed is really 
>important for me. I have amazing improvement over not buffered io, so I 
>would like to keep it buffered. I'm able to live with a small lost of 
>logging at the end due to the buffer that has not been emptied. And if I'm 
>correct, the default size for the buffer is 8kb. For me, 8kb is too big so 
>I want to reduce this size.

Yes, the default buffer for buffered for BufferedWriter is 8KB.

I am surprised to learn that the bufferedIO option yields in "an amazing 
improvement". Which JDK version are you using?


>Here is my problem: whatever number I put in the BufferSize parameter, it 
>is ALWAYS a 8kb buffer. The final size of my log file is 8kb or less than 
>the log file I would have for the same operations sequence in a not 
>buffered IO.

I fail to not understand the above sentence.


>I set the ImmediateFlush parameter to false and the BufferedIO parameter 
>to true. So, anybody has an idea on what could be the source of my problem 
>here? I really don' get it!
>
>I have a secondary question: that BufferSize parameter, is it a size in kb 
>or a size in number of log statements?

It size in bytes.

>  Because, if what I read was correct, in AsyncAppender, BufferSize is a 
> number of log statements.

Correct.  In AsyncAppender, BufferSize is a number of log statements.

>Pascal

-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp

      import org.apache.Facetime;
      ApacheCon US 2003, 18-21 November http://apachecon.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Mime
View raw message