Managing the Tracing

Apr 21, 2009 at 10:00 PM

Just been through the reference example and it's very good......comprehensively covers the "How to log", provides a suitable target for the logging (your DB TraceListener and Log DB) and covers the enablement far so good....

What about a final piece on how implement remote processes for enablement and disablement of logging, for example how to use WMI and say Powershell to remotely enable logging and say define the TraceListener......this would be the final piece of the puzzle for your reference example that could be used as a model for a production application.....

Jun 1, 2009 at 6:48 AM

Hi Marty,

There aren't any provisions to update or modify your configuration settings via Powershell or WMI out of the box though you could build your own implementation to do this.

The primary way people update this during runtime is to modify the configuration file itself. For ASP.NET this will cause the usual application domain drain stop (new requests are redirected to a new app domain whilst the existing appdomain waits for executing requests to complete before being torn down). In the case of any other app where this behavior doesn't happen (i.e. Windows Service or Windows Forms application) then you can call Trace.Refresh to force the configration to be re-read. This updates the configuration settings within the current app-domain.

Again you could create a component that allows the System.Diagnostics pieces to be manipulated at runtime (via Powershell, WMI or however you like) but you'll have to do this yourself - most people are happy to just change the config file when necessary.