“Great logging, terrible name”Long time readers of this blog are probably aware that I’m a big fan of logging and instrumentation. The keen eyed of you may have even spotted the subject of this post in my recent post Xaml for config. The clue was the name of the System.Diagnostics TraceListener: “Ukadc.Diagnostics.Listeners.InMemoryTraceListener”. What’s that all about then?
Ukadc.Diagnostics is a library of extensions for .NET’s System.Diagnostics that I’m working on with some colleagues from Microsoft’s UK Application Development Consulting (UKADC) team. The project was born out of a conversation with Morgan Skinner when I mentioned that I tended to use log4net, nlog or Enterprise Library logging over the stuff that ships out of the box (OOB) with .NET 2+. He wanted to know why and this was roughly what I replied:
- There isn’t enough OOB – for example no database support, no email support and just two filters
- Lack of configurability of output (i.e. little or no control over what and how data is written by the listeners)
- You can only have one filter per listener (no complex routing)
- It isn’t easy enough to extend 
- The API is confusing when compared to the competition
- No need to take a dependency on an external library – it’s available right away without thinking about it
- No concrete dependency on Open Source – not a problem for many, but a blocker for others
Over the course of the next few posts I’ll be introducing this project, how it works and what it can do but first, let’s get a few FAQ’s out of the way.Q. Is this a replacement for Enterprise Library logging (EntLib) or intended to compete with EntLib, log4net or nlog?
A. Abolutely not. EntLib is much more than just a logging framework. I think these are all great projects and if you’re happy using them I suggest you stick with them. However, I imagine Ukadc.Diagnostics will have two main audiences; people who:
- don’t do much or any logging at the moment
- refuse to take a direct dependency on entlib/log4net/nlog for whatever reason
Q. When will the project be complete??
A. I hope it will continually evolve but I’m considering the current state an early CTP and, based on getting plenty of community feedback (yes, that means you!) hopefully we’ll get to a beta very quickly. So get involved, let us know what’s right and what’s wrong.
- From zero to logging with System.Diagnostics
- Using tokens in Ukadc.Diagnostics to control output
- Creating your own tokens
- Using the SQL Trace Listener
- Using the SQL Trace Listener with Enterprise Library logging
- Using the Ukadc.Diagnostics with existing TraceSources
- and more…
: In the April ’06 edition of MSDN Magazine Krzysztof Cwalina wrote: “Custom trace listeners can be implemented by inheriting from the TraceListener class directly. But for historical reasons, this is not very easy. TraceListener contains many interdependent virtual members that can be overridden. And after working with these APIs for several years, I still forget which members need to be overridden in which scenarios.” (From Extending System.Diagnostics).
Originally posted by Josh Twist on 25th of April 2008 here.