What are Trace switches? Describe how to create and use Trace switches.

Trace switches allow us to filter, enable/disable the outputs through Trace. We can configure them through the config file.

There are 3 types of trace switches:

  • BooleanSwitch: Enable/Disable trace statements.
  • TraceSwitch and SourceSwitch: used for trapping particular Trace levels.
BooleanSwitch dataSwitch = new BooleanSwitch("Comment", "module1");
TraceSwitch generalSwitch = new TraceSwitch("comment","module1");