What are Trace Listeners and Trace Switches? - C#.NET

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.

Example:
<configuration>
   <system.diagnostics>
      <switches>
          <add name="DataMessagesSwitch" value="0" />
          <add name="TraceLevelSwitch" value="0" />
      </switches>
   </system.diagnostics>
</configuration>
both switches are off, to turn them on , replace 0 by 1.
How to implement tracing with an example using C#.NET
Explain how to implement tracing - In web.config, set EnableTracing=”true”...
Debugging Windows in C#.NET
Explain all the windows that help with your debugging - This window provides a description for the flow of application till the current line where the debugger is pointing to. It gives the page information, method name, arguments, line number etc...
Debug class methods - C#.NET
Explain the Debug class methods - Assert:This method checks for a condition. It displays a user message if the condition is false...
Post your comment