Wednesday, September 07, 2011

WCF–setting up tracing

All you need to do is to add is the following in your config file (under <Configuration>)

<system.diagnostics>
  <sources>
   <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true" >
    <listeners>
     <add type="System.Diagnostics.DefaultTraceListener" name="Default">
      <filter type=""/>
     </add>
     <add initializeData="myTraceLog.svclog" type="System.Diagnostics.XmlWriterTraceListener" name="sdt" traceOutputOptions="DateTime, Timestamp">
        <filter type=""/>
     </add>
    </listeners>
   </source>
  </sources>
  <trace autoflush="true"/>
</system.diagnostics>

The trace will get written to “myTraceLog.svclog” and can be viewed using “SvcTraceViewer.exe” which can typically be found at “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin”

No comments: