< configuration >
< system.diagnostics > <switches>
<add name= "Myswitch" value= "4"/>
</switches>
< trace AutoFlush = "false" Indentsize = "4" >
< listeners >
< add name = "MyListener"
Type = "System.Diagnostics.TextWriterTraceListener"
initializedata = "TextWriterOutput.log"/>
< remove name = "Default"/>
</Listeners >
</Trace >
</system.diagnostics >
</configuration >
System.Diagnostics.Trace this sealed class, in fact, is also a static class, because all of its methods and properties are static. The Trace class is primarily WriteLine these write trace methods. Where to write it. Is trace.listeners this tracelistenercollection in the east.
This is clear, as long as the target into the listeners on the line, there will be the above <add ... /> this passage.
Swithces is Trace's rank 0 = 0ff, 1 = Error, 2 = Warning, 3 = Info, 4 = Verbose.
When applied Trace.WriteLine ();
TraceSwitch Appswitch = new TraceSwitch ("Myswitch", "Trace level");