Monday, February 1, 2010

What are Trace Listeners and Trace Switches?

Trace listeners are objects that are used to receive store and route tracing information. The trace listener decides the final destination where the tracing information is routed to. There are 3 types
Default, TextWriter and EventLog
Trace switches are used to define behavior of Trace Listeners.

Explain how to implement tracing with an example using C#.NET.
In web.config, set EnableTracing=”true”
System.Diagnostics.Trace.WriteLine ("Error in Method1.");
System.Diagnostics.Trace.WriteLineIf(variable, "Error in Method1.");

0 Comments: