logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NeerajG <neeraj.geh...@citi.com>
Subject Re: log4net slowness
Date Tue, 03 Feb 2009 13:16:23 GMT

Will try this, but even if I do this. My understanding was even though
log4net will write once buffer reached 4K, it will retain the %d from
ConversionPattern layout of the time it was issued the log.Debug? Is that
the time it flushes to disk or when the log.Debug was issued?


Ron Grabowski wrote:
> 
> Log4net is using whatever defaults the FileStream has for efficient IO. Do
> you know what FileStream settings will make your writes faster? If so, you
> can just pass those in yourself:
> 
> // untested
> public class MyRollingFileAppender : RollingFileAppender
> {
>     private int fileStreamBufferSize = 128; // ???
> 
>     public override void ActivateOptions()
>     {
>         base.ActivateOptions();
> 
>         Writer = new StreamWriter(new FileStream(
>             File, 
>             FileMode.Append, 
>             FileSystemRights.FullControl,
>             FileShare.ReadWrite, FileStreamBufferSize, 
>             FileOptions.WriteThrough), 
>                 Encoding.Default, 
>                 FileStreamBufferSize);
>     }
> 
>     public int FileStreamBufferSize
>     {
>         get { return fileStreamBufferSize; }
>         set { fileStreamBufferSize = value; }
>     }
> }
> 
> Have you tried setting TextWriterAppender.ImmediateFlush? Can you use
> another appender like the MemoryAppender or a code profiler?
> 
> 
> 
> ----- Original Message ----
> From: NeerajG <neeraj.gehani@citi.com>
> To: log4net-dev@logging.apache.org
> Sent: Monday, February 2, 2009 10:24:02 PM
> Subject: log4net slowness
> 
> 
> I have an app which uses log4net currently set to DEBUG level. I use
> RollingFileAppender in our application. I have noticed that log4net
> flushes
> like in 15-16 ms interval. Has anyone seen this before? Is this something
> which is documented? Is there a way that we could reduce that? I want to
> measure some other performance numbers and in this setting which seems to
> be
> dumping every 15 ms its tough to measure performance.
> 
> Any suggestions are welcome.
> -- 
> View this message in context:
> http://www.nabble.com/log4net-slowness-tp21803294p21803294.html
> Sent from the Log4net - Dev mailing list archive at Nabble.com.
> 
> 

-- 
View this message in context: http://www.nabble.com/log4net-slowness-tp21803294p21809688.html
Sent from the Log4net - Dev mailing list archive at Nabble.com.


Mime
View raw message