logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: log4net slowness
Date Tue, 03 Feb 2009 04:46:42 GMT
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.

Mime
View raw message