I\'m trying to use System.Diagnostics to do some very basic logging. I figure I\'d use what\'s in the box rather than taking on an extra dependency like Log4Net or EntLib. <
You have to
1) declare a switch and set its value:
2) associate this switch with a TraceSource you use:
So, whatever you write via TraceSource named "MySource" is filtered according to the switch value.
If you use static methods like Trace.Write, I suppose, you cannot use switches at all, because there is no TraceSource to apply the filter.
If you want to turn off tracing by static methods, just remove all the listeners: .