My Favorite System.Net trace configuration file dumps Process ID and Date Time Information

Often you need to correlate a .NET trace with a Netmon trace.  To do that you need the date and time of the call from the System.Net trace.  This will do it!

NOTE:  This section is configures where the log file is and where it should be written: initializeData="System.Net.trace.log"
Specify the path and file name and make sure the process running has permissions to write that file in the location you specify!


Copy Code:

        <trace autoflush="true" />
                <source name="System.Net">
                <add name="System.Net"/>
                <source name="System.Net.HttpListener">
                <add name="System.Net"/>
        <source name="System.Net.Sockets">
                <add name="System.Net"/>
        <source name="System.Net.Cache">
                <add name="System.Net"/>
                 traceOutputOptions = "ProcessId, DateTime"
        <add name="System.Net" value="Verbose" />
        <add name="System.Net.Sockets" value="Verbose" />
        <add name="System.Net.Cache" value="Verbose" />
        <add name="System.Net.HttpListener" value="Verbose" />

Hint.  If Verbose is too verbose you can change that value to one of these:

Critical, Error, Verbose, Warning, and Information.

Ref: How to: Configure Network Tracing

If you find this useful, please drop me a note in the comments!

Comments (3)
  1. Connie says:

    This was very helpful.

  2. Joshua Russo says:

    If you're trying to debug web requests, make sure to add System.Net.Http to the list

  3. Tawab Wakil says:

    If the config also has a “configSections” section, be sure the “system.diagnostics” section goes below it to avoid errors.

Comments are closed.

Skip to main content