log4net SDK Reference

BufferingAppenderSkeleton Class

Abstract base class implementation of IAppender that buffers events in a fixed size buffer.

For a list of all members of this type, see BufferingAppenderSkeleton Members.

System.Object
   log4net.Appender.AppenderSkeleton
      log4net.Appender.BufferingAppenderSkeleton
         log4net.Appender.AdoNetAppender
         log4net.Appender.BufferingForwardingAppender
         log4net.Appender.RemotingAppender
         log4net.Appender.SmtpAppender
         log4net.Appender.SmtpPickupDirAppender

[Visual Basic]
MustInherit Public Class BufferingAppenderSkeleton
    Inherits AppenderSkeleton
[C#]
public abstract class BufferingAppenderSkeleton : AppenderSkeleton

Thread Safety

This type is not safe for multithreaded operations.

Remarks

This base class should be used by appenders that need to buffer a number of events before logging them. For example the AdoNetAppender buffers events and then submits the entire contents of the buffer to the underlying database in one go.

Subclasses should override the SendBuffer method to deliver the buffered events.

The BufferingAppenderSkeleton maintains a fixed size cyclic buffer of events. The size of the buffer is set using the BufferSize property.

A ITriggeringEventEvaluator is used to inspect each event as it arrives in the appender. If the Evaluator triggers, then the current buffer is sent immediately (see SendBuffer). Otherwise the event is stored in the buffer. For example, an evaluator can be used to deliver the events immediately when an ERROR event arrives.

The buffering appender can be configured in a Lossy mode. By default the appender is NOT lossy. When the buffer is full all the buffered events are sent with SendBuffer. If the Lossy property is set to true then the buffer will not be sent when it is full, and new events arriving in the appender will overwrite the oldest event in the buffer. In lossy mode the buffer will only be sent when the Evaluator triggers. This can be useful behavior when you need to know about ERROR events but not about events with a lower level, configure an evaluator that will trigger when an ERROR event arrives, the whole buffer will be sent which gives a history of events leading up to the ERROR event.

Requirements

Namespace: log4net.Appender

Assembly: log4net (in log4net.dll)

See Also

BufferingAppenderSkeleton Members | log4net.Appender Namespace