Apache log4net� SDK Documentation - Microsoft .NET Framework 4.0

XmlLayout Class

Layout that formats the log events as XML elements.

For a list of all members of this type, see XmlLayout Members.

System.Object
���log4net.Layout.LayoutSkeleton
������log4net.Layout.XmlLayoutBase
���������log4net.Layout.XmlLayout

[Visual�Basic]
Public�Class�XmlLayout
����Inherits�XmlLayoutBase
[C#]
public�class�XmlLayout : XmlLayoutBase

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The output of the XmlLayout consists of a series of log4net:event elements. It does not output a complete well-formed XML file. The output is designed to be included as an external entity in a separate file to form a correct XML file.

For example, if abc is the name of the file where the XmlLayout output goes, then a well-formed XML file would be:

[XML]
 <?xml version="1.0" ?>
 
 <!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM "abc">]>

 <log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2>
     &data;
 </log4net:events>
 

This approach enforces the independence of the XmlLayout and the appender where it is embedded.

The version attribute helps components to correctly interpret output generated by XmlLayout. The value of this attribute should be "1.2" for release 1.2 and later.

Alternatively the Header and Footer properties can be configured to output the correct XML header, open tag and close tag. When setting the Header and Footer properties it is essential that the underlying data store not be appendable otherwise the data will become invalid XML.

Requirements

Namespace: log4net.Layout

Assembly: log4net (in log4net.dll)

See Also

XmlLayout Members | log4net.Layout Namespace