XmlLogFormatter

Topics: Logging Application Block
May 1, 2007 at 9:36 AM
Hi,

When trying to use the XmlLogFormatter in my logging block I get the following error: "The type XmlLogFormatter does not contain the ConfigurationElementTypeAttribute"

Did I something wrong in adding the formatter to the web.config?
I used the this part of code in my web.config:
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.XmlLogFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.0.0.0"
name="XML Formatter" />
</formatters>

Thanks in advance,

Guus
May 2, 2007 at 2:16 AM
I don't believe the XmlFormatter is expected to be used as a general formatter for any TraceListener, which is why you cannot add it as a Formatter directly using the configuration editor. From what I could find, it is currently only used by the XmlTraceListener. I recommend looking at the XmlTraceListener if you want your log messages to be formatted as XML.

Regards,

Dave

________________________________

David Hayden
Microsoft MVP C#
Mar 4, 2008 at 7:29 PM
But XmlTraceListener doesn't take any input argument, unlike FlatFileTraceListener. so how do you use XmlLogFormatter in conjunction with XmlTraceListener?


DavidHayden wrote:
I don't believe the XmlFormatter is expected to be used as a general formatter for any TraceListener, which is why you cannot add it as a Formatter directly using the configuration editor. From what I could find, it is currently only used by the XmlTraceListener. I recommend looking at the XmlTraceListener if you want your log messages to be formatted as XML.

Regards,

Dave

________________________________

David Hayden
Microsoft MVP C#