Enabling Tracing for System.Net

In whidbey, System.Net has a cool retail tracing implementation. It writes most calls made to public API's to a TraceListener. You can setup your own tracelisteners, or use the config file to setup a default listener.

This facility is very useful in debugging problems with applications.

Here is the example config file which enables Verbose tracing.

<?xml version="1.0" encoding="UTF-8" ?>

 <trace autoflush="true" />

 <source name="System.Net">

   <add name="System.Net"/>
 <source name="System.Net.Sockets">
   <add name="System.Net"/>
 <source name="System.Net.Cache">
   <add name="System.Net"/>
                <add name="System.Net" value="Verbose" />
  <add name="System.Net.Sockets" value="Verbose" />               
  <add name="System.Net.Cache" value="Verbose" />

NOTE: If you are doing logging inside of the ASP.NET process, make sure to give the ASP.NET process identity WRITE permissions to the directory where you want the log to be written.