
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
440
|
Chapter 8: Diagnostics
This XML file must have the same name as the executable using these switches, fol-
lowed by .config. For example, if the executable name were Accounting.exe, the con-
figuration file would be named Accounting.exe.config. This file should be placed in
the same directory as the executable Accounting.exe. For more information on this
file, see Recipe 8.1.
The application configuration file can also set trace and debug output levels in this
same
switches tag. These levels identify the scope of the output, for example, if the
output will contain only warnings, only errors, only informational messages, or some
combination thereof. The level specified is the maximum trace level for the switch so
it includes all levels below it up through that level. Of course, this is only an exam-
ple; you may define your own levels as well. For more information on controlling
these output levels, see Recipe 8.3.
The
TraceSwitch class operates similarly to the BooleanSwitch class, except that the
TraceSwitch class encapsulates the available levels that control the type and amount
of debug/trace output. The
BooleanSwitch class is simply an on/off switch used to
enable or disable debugging/tracing.
When the
TraceSwitch is created, it attempts to locate a switch with the same name
as the ...