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

SystemObject
  log4net.AppenderAppenderSkeleton
    log4net.AppenderBufferingAppenderSkeleton
      log4net.AppenderAdoNetAppender
      log4net.AppenderBufferingForwardingAppender
      log4net.AppenderRemotingAppender
      log4net.AppenderSmtpAppender
      log4net.AppenderSmtpPickupDirAppender

Namespace: log4net.Appender
Assembly: log4net (in log4net.dll) Version: 2.0.6.0-.NET 4.0
Syntax

public abstract class BufferingAppenderSkeleton : AppenderSkeleton

The BufferingAppenderSkeleton type exposes the following members.

Constructors

  NameDescription
Protected methodBufferingAppenderSkeleton
Initializes a new instance of the BufferingAppenderSkeleton class.
Protected methodBufferingAppenderSkeleton(Boolean)
Initializes a new instance of the BufferingAppenderSkeleton class.
Top
Properties

  NameDescription
Public propertyBufferSize
Gets or sets the size of the cyclic buffer used to hold the logging events.
Public propertyErrorHandler
Gets or sets the IErrorHandler for this appender.
(Inherited from AppenderSkeleton.)
Public propertyEvaluator
Gets or sets the ITriggeringEventEvaluator that causes the buffer to be sent immediately.
Public propertyFilterHead
The filter chain.
(Inherited from AppenderSkeleton.)
Public propertyFix
Gets or sets a the fields that will be fixed in the event
Public propertyLayout
Gets or sets the ILayout for this appender.
(Inherited from AppenderSkeleton.)
Public propertyLossy
Gets or sets a value that indicates whether the appender is lossy.
Public propertyLossyEvaluator
Gets or sets the value of the ITriggeringEventEvaluator to use.
Public propertyName
Gets or sets the name of this appender.
(Inherited from AppenderSkeleton.)
Public propertyOnlyFixPartialEventData Obsolete.
Gets or sets a value indicating if only part of the logging event data should be fixed.
Protected propertyRequiresLayout
Tests if this appender requires a Layout to be set.
(Inherited from AppenderSkeleton.)
Public propertyThreshold
Gets or sets the threshold Level of this appender.
(Inherited from AppenderSkeleton.)
Top
Methods

  NameDescription
Public methodActivateOptions
Initialize the appender based on the options set
(Overrides AppenderSkeletonActivateOptions.)
Public methodAddFilter
Adds a filter to the end of the filter chain.
(Inherited from AppenderSkeleton.)
Protected methodAppend(LoggingEvent)
Append a bulk array of logging events.
(Inherited from AppenderSkeleton.)
Protected methodAppend(LoggingEvent)
This method is called by the DoAppend(LoggingEvent) method.
(Overrides AppenderSkeletonAppend(LoggingEvent).)
Public methodClearFilters
Clears the filter list for this appender.
(Inherited from AppenderSkeleton.)
Public methodClose
Closes the appender and release resources.
(Inherited from AppenderSkeleton.)
Public methodDoAppend(LoggingEvent)
Performs threshold checks and invokes filters before delegating actual logging to the subclasses specific [M:Append(LoggingEvent)] method.
(Inherited from AppenderSkeleton.)
Public methodDoAppend(LoggingEvent)
Performs threshold checks and invokes filters before delegating actual logging to the subclasses specific [M:Append(LoggingEvent[])] method.
(Inherited from AppenderSkeleton.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFilterEvent
Test if the logging event should we output by this appender
(Inherited from AppenderSkeleton.)
Protected methodFinalize
Finalizes this appender by calling the implementation's Close method.
(Inherited from AppenderSkeleton.)
Public methodFlush
Flush the currently buffered events
Public methodFlush(Boolean)
Flush the currently buffered events
Public methodFlush(Int32)
Flushes any buffered log data.
(Overrides AppenderSkeletonFlush(Int32).)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodIsAsSevereAsThreshold
Checks if the message level is below this appender's threshold.
(Inherited from AppenderSkeleton.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnClose
Close this appender instance.
(Overrides AppenderSkeletonOnClose.)
Protected methodPreAppendCheck
Called before [M:Append(LoggingEvent)] as a precondition.
(Inherited from AppenderSkeleton.)
Protected methodRenderLoggingEvent(LoggingEvent)
Renders the LoggingEvent to a string.
(Inherited from AppenderSkeleton.)
Protected methodRenderLoggingEvent(TextWriter, LoggingEvent)
Renders the LoggingEvent to a string.
(Inherited from AppenderSkeleton.)
Protected methodSendBuffer
Sends the events.
Protected methodSendFromBuffer
Sends the contents of the buffer.
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
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

Reference