I have app that configures its trace source as follows:
var traceSource = new TraceSource("MyTraceSource");
traceSource.Switch = new SourceSwitch("MyTraceSwitch") { **Level = SourceLevels.Information** };
var traceListener = new TextWriterTraceListener(logFilePath);
traceListener.TraceOutputOptions = TraceOptions.DateTime;
traceSource.Listeners.Clear();
traceSource.Listeners.Add(traceListener);
Trace.AutoFlush = true;
The app always uses this trace source to trace events. Please note that SourceLevels.Information is hardcoded in trace switch. Now I need to change the trace switch level to Verbose. Is it possible to accomplish via app.config file? I tried many xml-configs but failed. Note I cannot change the source code only app.config.
switchValue="Information"
attribute, overriding the default value specified in the application code. Set it toVerbose
instead ofInformation
to do what the original poster asked. – Nomadic