This project is read-only.

How to enable WCF message logging

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

Use the following steps to enable WCF message logging:
  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 Message Logging link.
  3. This enables the message logging for your service and it also creates a listener (ServiceModelMessageLoggingListener) and a source (System.ServiceModel.MessageLogging) under the Listeners and Sources folder respectively. You can configure Message logging levels at both the service and the transport levels. To configure the message logging levels,
  4. In the left pane, select MessageLogging under the Diagnostics node.
  5. Set the LogMessagesAtServiceLevel attribute to True choosing from the drop down. The LogMessagesAtTransportLevel attribute is True by default.

To determine where the messages will be logged select ServiceModelMessageLoggingListener under the Listeners node and note the value of the InitData attribute. The default location where messages are logged is c:\inetpub\wwwroot\WCFService\web_messages.svclog.

The configuration file should look as follows:
        <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
                <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                    <filter type="" />
                <add name="ServiceModelMessageLoggingListener">
                    <filter type="" />
        <add *initializeData="c:\inetpub\wwwroot\auditingwcf\web_messages.svclog"*
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
            <filter type="" />

     <messageLogging logMalformedMessages="true" *logMessagesAtServiceLevel="true"*
       logMessagesAtTransportLevel="true" />

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


No comments yet.