Table of Contents

Class XmlLayoutSchemaLog4j

Namespace
log4net.Layout
Assembly
log4net.dll

Layout that formats the log events as XML elements compatible with the log4j schema

public class XmlLayoutSchemaLog4j : XmlLayoutBase, ILayout, IOptionHandler
Inheritance
XmlLayoutSchemaLog4j
Implements
Inherited Members

Remarks

Formats the log events according to the http://logging.apache.org/log4j schema.

Constructors

XmlLayoutSchemaLog4j()

Constructs an XMLLayoutSchemaLog4j

public XmlLayoutSchemaLog4j()

XmlLayoutSchemaLog4j(bool)

Constructs an XMLLayoutSchemaLog4j.

public XmlLayoutSchemaLog4j(bool locationInfo)

Parameters

locationInfo bool

Remarks

The LocationInfo option takes a boolean value. By default, it is set to false which means there will be no location information output by this layout. If the the option is set to true, then the file name and line number of the statement at the origin of the log statement will be output.

If you are embedding this layout within an SMTPAppender then make sure to set the LocationInfo option of that appender as well.

Properties

Version

The version of the log4j schema to use.

public string Version { get; set; }

Property Value

string

Remarks

Only version 1.2 of the log4j schema is supported.

Methods

FormatXml(XmlWriter, LoggingEvent)

Actually do the writing of the xml

protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent)

Parameters

writer XmlWriter

the writer to use

loggingEvent LoggingEvent

the event to write

Remarks

Generate XML that is compatible with the log4j schema.