MemoryAppender Class | Apache log4net™ SDK Documentation

Stores logging events in an array.
Inheritance Hierarchy

System
Object
log4net.Appender
AppenderSkeleton
log4net.Appender
MemoryAppender

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

C#
VB
C++
F#
Copy

    public class MemoryAppender : AppenderSkeleton

    Public Class MemoryAppender
    	Inherits AppenderSkeleton

    public ref class MemoryAppender : public AppenderSkeleton

    type MemoryAppender =
        class
            inherit AppenderSkeleton
        end

The MemoryAppender type exposes the following members.

Constructors

| Name | Description
--- | --- | ---
| MemoryAppender | Initializes a new instance of the MemoryAppender class.

Top
Properties

| Name | Description
--- | --- | ---
| ErrorHandler | Gets or sets the IErrorHandler for this appender. (Inherited from AppenderSkeleton.)
| FilterHead | The filter chain. (Inherited from AppenderSkeleton.)
| Fix | Gets or sets the fields that will be fixed in the event
| Layout | Gets or sets the ILayout for this appender. (Inherited from AppenderSkeleton.)
| Name | Gets or sets the name of this appender. (Inherited from AppenderSkeleton.)
| OnlyFixPartialEventData | Obsolete. Gets or sets a value indicating whether only part of the logging event data should be fixed.
| RequiresLayout | Tests if this appender requires a Layout to be set. (Inherited from AppenderSkeleton.)
| Threshold | Gets or sets the threshold Level of this appender. (Inherited from AppenderSkeleton.)

Top
Methods

| Name | Description
--- | --- | ---
| ActivateOptions | Initialize the appender based on the options set (Inherited from AppenderSkeleton.)
| AddFilter | Adds a filter to the end of the filter chain. (Inherited from AppenderSkeleton.)
| Append( LoggingEvent ) | Append a bulk array of logging events. (Inherited from AppenderSkeleton.)
| Append(LoggingEvent) | This method is called by the DoAppend(LoggingEvent) method. (Overrides AppenderSkeleton Append(LoggingEvent).)
| Clear | Clear the list of events
| ClearFilters | Clears the filter list for this appender. (Inherited from AppenderSkeleton.)
| Close | Closes the appender and release resources. (Inherited from AppenderSkeleton.)
| DoAppend(LoggingEvent) | Performs threshold checks and invokes filters before delegating actual logging to the subclasses specific [M:Append(LoggingEvent)] method. (Inherited from AppenderSkeleton.)
| DoAppend( LoggingEvent ) | Performs threshold checks and invokes filters before delegating actual logging to the subclasses specific [M:Append(LoggingEvent[])] method. (Inherited from AppenderSkeleton.)
| Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
| FilterEvent | Test if the logging event should we output by this appender (Inherited from AppenderSkeleton.)
| Finalize | Finalizes this appender by calling the implementation's Close method. (Inherited from AppenderSkeleton.)
| Flush | Flushes any buffered log data. (Inherited from AppenderSkeleton.)
| GetEvents | Gets the events that have been logged.
| GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.)
| GetType | Gets the Type of the current instance. (Inherited from Object.)
| IsAsSevereAsThreshold | Checks if the message level is below this appender's threshold. (Inherited from AppenderSkeleton.)
| MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.)
| OnClose | Is called when the appender is closed. Derived classes should override this method if resources need to be released. (Inherited from AppenderSkeleton.)
| PopAllEvents | Gets the events that have been logged and clears the list of events.
| PreAppendCheck | Called before [M:Append(LoggingEvent)] as a precondition. (Inherited from AppenderSkeleton.)
| RenderLoggingEvent(LoggingEvent) | Renders the LoggingEvent to a string. (Inherited from AppenderSkeleton.)
| RenderLoggingEvent(TextWriter, LoggingEvent) | Renders the LoggingEvent to a string. (Inherited from AppenderSkeleton.)
| ToString | Returns a String that represents the current Object. (Inherited from Object.)

Top
Fields

| Name | Description
--- | --- | ---
| m_eventsList | The list of events that have been appended.
| m_fixFlags | Value indicating which fields in the event should be fixed

Top
Remarks

The memory appender stores all the logging events that are appended in an in-memory array.

Use the [M:PopAllEvents()] method to get and clear the current list of events that have been appended.

Use the [M:GetEvents()] method to get the current list of events that have been appended. Note there is a race-condition when calling [M:GetEvents()] and [M:Clear()] in pairs, you better use in that case.

Use the [M:Clear()] method to clear the current list of events. Note there is a race-condition when calling [M:GetEvents()] and [M:Clear()] in pairs, you better use in that case.

See Also

#### Reference

log4net.Appender Namespace