XML Logging in the .NET Framework(13 min read)

This was originally going to be some guideline instructions for a CodePlex project, Essential.Diagnostics that I work on, but it ended up being more an opinion piece so I thought it would fit better on a blog.

There are several trace listeners (loggers) in the .NET Framework that can produce XML output. Outputting to XML results in more complex (verbose) files than, say, a simple text file output, but usually has the benefit of being better processed by tools, correlated across tiers, etc.

There are three main XML listeners, plus one extension in Essential.Diagnostics:

  • XmlWriterTraceListener
  • RollingXmlTraceListener (in Essential.Diagnostics)
  • EventSchemaTraceListener (in System.Core)
  • EventProviderTraceListener (in System.Core)

Examples of how to configure and use each one (used to produce the output below) is provided in the Essential.Diagnostics project.
Continue reading XML Logging in the .NET Framework(13 min read)