BufferingAppenderSkeleton ClassApache log4net™ SDK Documentation
Abstract base class implementation of IAppender that buffers events in a fixed size buffer.
Inheritance Hierarchy

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

Namespace: log4net.Appender
Assembly: log4net (in log4net.dll) Version: 1.2.15.0 (1.2.15.0)
Syntax

public abstract class BufferingAppenderSkeleton : AppenderSkeleton
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 [M:SendBuffer(LoggingEvent[])] 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 [M:SendBuffer(LoggingEvent[])]). 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 [M:SendBuffer(LoggingEvent[])]. 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.

See Also