views:

63

answers:

2

I have enabled trace logging in .NET to output the network data going back and forth so I can see the SOAP requests being sent to a web service. This seems to be the best way on a site that I can't debug or add a proxy between itself and the web service.

Here are the lines I've added to the web.config to enable it:

 <system.diagnostics>
  <trace autoflush="true"/>
  <sources>
   <source name="System.Net" maxdatasize="1024">
    <listeners>
     <add name="TraceFile"/>
    </listeners>
   </source>
   <source name="System.Net.Sockets" maxdatasize="1024">
    <listeners>
     <add name="TraceFile"/>
    </listeners>
   </source>
  </sources>
  <sharedListeners>
   <add name="TraceFile" type="System.Diagnostics.TextWriterTraceListener" initializeData="images/trace.log"/>
  </sharedListeners>
  <switches>
   <add name="System.Net" value="Verbose"/>
   <add name="System.Net.Sockets" value="Verbose"/>
  </switches>
 </system.diagnostics>

Does anyone know of a log viewer for this? My searching has come up fruitless.

+1  A: 

If you change listener to XmlWriterTraceListener you can use SvcTraceViewer.exe to open the trace file. It is supposed to be used with WCF tracing and message logging but it works with any valid traces from XmlWriterTraceListener.

Ladislav Mrnka
I will have a try and see how it goes.
tgandrews
A: 

IF your TextWriterTraceListener is writing to a text file, you can use a tail viewer (ie your view of the text file looks at the bottom of the file, constantly updating, rather than the start) like baretail

Jonny Cundall
There is a lot of output, and all I really want is the soap messages going back and forth. tail will just show me the end of the file, which is not really an acceptable solution. Thanks anyway.
tgandrews
If you want just soap messages you should write soap extension which will log them. Such soap extension is provided in MSDN as example: http://msdn.microsoft.com/en-us/library/system.web.services.protocols.soapextension.aspx
Ladislav Mrnka