<p>Trace instrumentation allows developers and administrators
to monitor the health of applications running in real-life settings (as opposed to
running in a debugger). Sometimes using a debugger can hide bugs and
obscure some performance and threading problems. Tracing is a very important
monitoring and debugging tool for distributed, multi-tier applications. Such
applications often contain problems that can only be observed when the application is
under a heavy load and the inherent randomness of a real-life environment.</p>
<p>This sample illustrates the basics of using the Trace and
Debug classes. Run it and take a look at the source code. You will see
how easy it is to add simple tracing to your applications.</p>
<p>You have to compile your instrumented applications with
TRACE or DEBUG compiler directives enabled. Otherwise all calls to Trace or
Debug (respectively) are ignored during compilation.</p>
<p>Before running the application, open a command line window
and run DbMon.exe. You will be able to see any Debug and Trace messages coming
from any application running on your system.</p>
<p>
<b>Note: </b> The Debug Monitor utility (DBMon.exe) is available from the Windows Platform SDK on the <a target="_blank" href="http://msdn.microsoft.com">Microsoft Developer Network</a> website.