Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

Enabling Network Tracing

Network tracing provides access to information about method invocations and network traffic generated by a managed application. You must complete the following tasks to enable network tracing in your application:

The most common trace destinations, also referred to as trace listeners, are the default listener and the log file.

Tracing uses the default listener if you do not specify a trace listener. You can view messages sent to the default listener by executing your code in a managed code-enabled debugger such as the CLR Debugger (DbgCLR.exe) shipped with the .NET Framework, or DBwin32.exe shipped with the Platform SDK. Using the CLR Debugger, the trace messages appear in the Output window.

If you prefer to use a file to receive traces, you can specify a log file by using configuration settings, as shown in the following example. (For a general discussion of configuration files, see Configuration Files.)

To send traces to a log file, add the following node to the <system.diagnostics> node of the appropriate configuration file (application or machine). You can change the name of the file (trace.log) to suit your needs.

<system.diagnostics>
  <trace autoflush="true" indentsize="4">
    <listeners>
      <add name="file" type="System.Diagnostics.TextWriterTraceListener" initializeData="trace.log"/>
    </listeners> 
  </trace>
</system.diagnostics>
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.