The XmlLayout generates XML Fragments for each message. XML does not lend
itself too well to a streaming format.

When using the XmlLayout with the FileAppender or RollingFileAppender the
file written will not be a valid XML document. It is a valid XML fragment.
However it can be included in a document. 

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 version="1.0" ?>

<!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM
"abc">]>

<log4net:events version="1.2"
xmlns:log4net="http://log4net.sourceforge.net/";>
    &data;
</log4net:events>

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


Nicko

> -----Original Message-----
> From: Matthew Easlea [mailto:[EMAIL PROTECTED] 
> Sent: 06 June 2004 23:46
> To: 'Log4NET User'
> Subject: XML Layout
> 
> Hi,
> 
> When I use XMLLayout using the rolling file appender is there 
> anyway for it to create valid XML files. By this I mean with 
> opening and closing <?XML> tag etc?
> 
> Cheers
> 
> Matthew James Easlea
> 
> 
> 

Reply via email to