Layout that formats the log events as XML elements.
For a list of all members of this type, see XmlLayout Members.
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
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.
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.
Footer properties can be configured to output the correct XML header, open tag and close tag. When setting the
Footer properties it is essential that the underlying data store not be appendable otherwise the data will become invalid XML.
Assembly: log4net (in log4net.dll)