Class XmlLayoutSchemaLog4j
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
locationInfobool
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
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
writerXmlWriterthe writer to use
loggingEventLoggingEventthe event to write
Remarks
Generate XML that is compatible with the log4j schema.