Table of Contents

Class LayoutSkeleton

Namespace
log4net.Layout
Assembly
log4net.dll

Extend this abstract class to create your own log layout format.

public abstract class LayoutSkeleton : ILayout, IOptionHandler
Inheritance
LayoutSkeleton
Implements
Derived
Inherited Members

Remarks

This is the base implementation of the ILayout interface. Most layout objects should extend this class.

Constructors

LayoutSkeleton()

Empty default constructor

protected LayoutSkeleton()

Remarks

Empty default constructor

Properties

ContentType

The content type output by this layout.

public virtual string ContentType { get; }

Property Value

string

The content type is "text/plain"

Remarks

The content type output by this layout.

This base class uses the value "text/plain". To change this value a subclass must override this property.

The footer for the layout format.

public virtual string Footer { get; set; }

Property Value

string

the layout footer

The Footer text will be appended after all the logging events have been formatted and appended.

Header

The header for the layout format.

public virtual string Header { get; set; }

Property Value

string

the layout header

Remarks

The Header text will be appended before any logging events are formatted and appended.

IgnoresException

Flag indicating if this layout handles exceptions

public virtual bool IgnoresException { get; set; }

Property Value

bool

false if this layout handles exceptions

Remarks

If this layout handles the exception object contained within LoggingEvent, then the layout should return false. Otherwise, if the layout ignores the exception object, then the layout should return true.

Set this value to override a this default setting. The default value is true, this layout does not handle the exception.

Methods

ActivateOptions()

Activate component options

public abstract void ActivateOptions()

Remarks

This is part of the IOptionHandler delayed object activation scheme. The ActivateOptions() method must be called on this object after the configuration properties have been set. Until ActivateOptions() is called this object is in an undefined state and must not be used.

If any of the configuration properties are modified then ActivateOptions() must be called again.

This method must be implemented by the subclass.

Format(TextWriter, LoggingEvent)

Implement this method to create your own layout format.

public abstract void Format(TextWriter writer, LoggingEvent loggingEvent)

Parameters

writer TextWriter

The TextWriter to write the formatted event to

loggingEvent LoggingEvent

The event to format

Remarks

This method is called by an appender to format the loggingEvent as text.

Format(LoggingEvent)

Convenience method for easily formatting the logging event into a string variable.

public string Format(LoggingEvent loggingEvent)

Parameters

loggingEvent LoggingEvent

Returns

string

Remarks

Creates a new StringWriter instance to store the formatted logging event.