Why isn't my log4net appender buffering?

Posted by Eric on Stack Overflow See other posts from Stack Overflow or by Eric
Published on 2010-03-16T21:17:46Z Indexed on 2010/03/16 21:21 UTC
Read the original article Hit count: 237

Filed under:
|
|

I've created a custom log4net appender. It descends from log4net.Appender.SmtpAppender which descends from log4net.Appender.BufferingAppenderSkeleton.

I programatically setup the following parameters in its constructor:

this.Lossy = false;  //don't drop any messages
this.BufferSize = 3; //buffer up to 3 messages
this.Threshold = log4net.Core.Level.Error; //append messages of Error or higher
this.Evaluator = new log4net.Core.LevelEvaluator(Level.Off); //don't flush the buffer for any message, regardless of level

I expect this would buffer 3 events of level Error or higher and deliver those events when the buffer is filled. However, I'm finding that the events are not buffered at all; instead, SendBuffer() is called immediately every time an error is logged.

Is there a mistake in my configuration?

Thanks

© Stack Overflow or respective owner

Related posts about log4net

Related posts about c#