home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / howto / doc / switches.aspx < prev    next >
Encoding:
Text File  |  2000-06-14  |  3.2 KB  |  74 lines

  1.  
  2. <!-- #include virtual="/quickstart/howto/include/header.inc" -->
  3.  
  4. <h4>How Do I...Use tracing switches and listeners?</h4>
  5.  
  6. <div class="indent" style="width:660"><font face="Tahoma" size="1">
  7.  
  8. <p>Trace instrumentation allows developers and administrators
  9. to monitor the health of applications running in real-life settings (as opposed to
  10. running in a debugger). Sometimes using a debugger can hide bugs and
  11. obscure some performance and threading problems. Tracing is a very important
  12. monitoring and debugging tool for distributed, multi-tier applications. Such
  13. applications often contain problems that can only be observed when the application is
  14. under a heavy load and the inherent randomness of a real-life environment.</p>
  15.  
  16. <p>This sample illustrates the basics of using the Trace and
  17. Boolean switches. A switch provides an efficient mechanism for
  18. enabling/disabling code paths at runtime using external settings. Run
  19. it and take a look at the source code. You will see how easy it is to add
  20. simple tracing to your applications. You can then go to the registry and 
  21. modify the settings of the switches and then run the sample again. You will
  22. possibly get a completely different output.</p>
  23.  
  24. <p>Set DWORD value of the following key to 0 (false) or 1 (true):</p>
  25.  
  26.     </font><font face="Courier New" color="Blue" size="1"><blockquote>
  27.         HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\COMPlus\Switches\ABooleanSwitch
  28.     </blockquote></font><font face="Tahoma" size="1">
  29.  
  30. <p>Set DWORD value of the following key to 0 (off), 1 (error), 2 (warning), 
  31. 3 (info), or 4 (verbose):</p>
  32.  
  33.     </font><font face="Courier New" color="Blue" size="1"><blockquote>
  34.         HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\COMPlus\Switches\ATraceSwitch
  35.     </blockquote></font><font face="Tahoma" size="1">
  36.  
  37. <p>For more information about switches and registry, please refer to the documentation
  38. for details on changing switch settings.</p>
  39.  
  40. <p>You have to compile your instrumented applications with
  41. TRACE or DEBUG compiler directives enabled. Otherwise all calls to Trace or
  42. Debug (respectively) are ignored during compilation. </p>
  43.  
  44. <p>Before running the application, open a command line window
  45. and run DbMon.exe. You will be able to see any Debug and Trace messages coming
  46. from any application running on your system.</p>
  47.  
  48. <p>
  49. <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.
  50. </p>
  51.  
  52. </font></div>
  53.  
  54. <h4>Example</h4>
  55.  
  56. <p>
  57. <div class="indent">
  58. <a target="_blank" href="/quickstart/howto/samples/Services/Tracing/Switches/switches.exe">
  59. <img style="border-color:black" border=1 src="/quickstart/images/genicon.gif"><br>
  60. </a>
  61. <div class="caption">Switches.exe</div><br>
  62. [<a target="_blank" href="/quickstart/howto/samples/Services/Tracing/Switches">View Sample</a>] | 
  63. [<a target="_blank" href="/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/Services/Tracing/Switches/Switches.src">View Source</a>]<p>
  64. </div>
  65.  
  66. <h4>Source Code</h4>
  67.  
  68. <div class="code">
  69. <xmp>
  70. <!-- #include virtual="/quickstart/howto/samples/Services/Tracing/Switches/Switches.cs" -->
  71. </xmp>
  72. </div>
  73.  
  74. <!-- #include virtual="/quickstart/howto/include/footer.inc" -->