How to enable WCF tracing

J.D. Meier, Jason Taylor, Prashant Bansode, Carlos Farre, Madhu Sundararajan, Steve Gregersen.

Use following steps to enable Tracing
  1. Open the web.config file of the WCF service using the Configuration editor tool (SvcConfigEditor.exe).
  2. In the Configuration editor, navigate to the Diagnostics node, and click the Enable Tracing link.
  3. This enables Tracing your WCF service and it also creates a listener (ServiceModelTraceListener) and a source (System.ServiceModel) under the Listeners and Sources folder respectively.

To determine where the traces will be written select ServiceModelTraceListener under the Listeners node and note the value of the InitData attribute. The default location where trace messages are written is c:\inetpub\wwwroot\auditingwcf\web_tracelog.svclog.

The configuration file should look as follows:
<system.diagnostics>
    <sources>
        <source name="System.ServiceModel" switchValue="Warning, ActivityTracing"
            propagateActivity="true">
            <listeners>
                <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                    <filter type="" />
                </add>
                <add name="ServiceModelTraceListener">
                    <filter type="" />
                </add>
            </listeners>
        </source>
    </sources>
    <sharedListeners>
        <add *initializeData="c:\inetpub\wwwroot\auditingwcf\web_tracelog.svclog"*
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
            <filter type="" />
        </add>
    </sharedListeners>
</system.diagnostics>

Last edited May 8, 2008 at 12:35 AM by prashantbansode, version 1

Comments

No comments yet.