Search code examples
c#iissoapsystem.diagnostics

Increase system.diagnostics packet logging size


We are using system.diagnostics in our IIS configuration to debug a SOAP failure. Our SOAP packets are a reasonable size so we get:

System.Net Verbose: 0 : [8392] (printing 1024 out of 2238)

Our configuration is:

  <system.diagnostics>
    <trace autoflush="true" />
    <sharedListeners>
      <add name="file" initializeData="c:\network.log" type="System.Diagnostics.TextWriterTraceListener" />
    </sharedListeners>
    <sources>
      <source name="System.Net" switchValue="Verbose">
        <listeners>
          <add name="file" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

Is there a way of increasing the printing such that we can get the whole XML packet (i.e. all of the 2238 bytes)?

--- Update: From the comments, updated section:

  <system.diagnostics>
    <trace autoflush="true" />
    <sharedListeners>
      <add name="file" initializeData="c:\network.log" type="System.Diagnostics.TextWriterTraceListener" />
    </sharedListeners>
    <sources>
      <source name="System.Net" tracemode="includehex" maxdatasize="4096">
        <listeners>
          <add name="System.Net"/>
        </listeners>
      </source>
      <source name="System.Net" switchValue="Verbose">
        <listeners>
          <add name="file" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
</configuration>

This has no effect on the output of the log.


Solution

  • So it turns out we got our names wrong in the above comment. The working configuration:

    <system.diagnostics>  
      <sources>  
        <source name="System.Net" tracemode="includehex" maxdatasize="4096">  
          <listeners>  
            <add name="System.Net"/>  
          </listeners>  
        </source>   
      </sources>  
      <switches>  
        <add name="System.Net" value="Verbose"/>  
      </switches>  
      <sharedListeners>  
        <add name="System.Net"  
          type="System.Diagnostics.TextWriterTraceListener"  
          initializeData="c:\network.log"  
        />  
      </sharedListeners>  
      <trace autoflush="true"/>  
    </system.diagnostics>
    

    @LexLi - thanks for the link.