Use TraceSwitch to control Debug and Trace

The TraceSwitch class defines four levels of information logging. They are defined in the TraceLevel enum.

 

LEVEL

NUMERIC VALUE

Off

0

Error

1

Warning

2

Info

3

Verbose

4

 

Each of the higher levels implies the lower level; if the level is set to Info, Error and Warning will also be set. The numeric values are used when setting the flag via an environment variable or registry setting.

The TraceSwitch class exposes properties that tell whether a specific trace level has been set, and a typical logging statement would check to see whether the appropriate property was set.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish