Archive for October, 2006

Trace listeners

October 3, 2006

In my post Solutions for basic logging I gave a very brief look at some solutions for implementing basic logging in an application. One of the tools I forgot to add was Trace listeners. I decided this was by far the best solution for my particular need: I can specify if the application is to perform logging or not by changing an XML value, I can easily choose the medium of the output, and writing the trace is simple.

I’m currently outputting to a text file but this could easily be the windows event log or XML fragment for example, and writing the message is as simple as writing to the console. I will deploy the application with logging off; If any issues arise I can tell the client to change the value (or include a script that will do it) and have them send the output. Easy!

I’ve noticed my application would benefit rethinking my logic (order of events, processing methods). This is to be expected really as in my initial builds I just wanted to make it work. I now want to make it as efficient as I can.

Trace Listener resources:

Tracing in .NET and Implementing Your Own Trace Listeners

TraceListener Class

Trace Listeners

Debugging once you go live: Trace Listeners