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.
E.g.:
both switches are off, to turn them on , replace 0 by 1.
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.");
No comments:
Post a Comment