WCF message tracing

To many times I’ve searched for this in google. How to trace the WCF messages to disk. Here is how:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.diagnostics>
    <sources>
      <source         name="System.ServiceModel.MessageLogging">
        <listeners>
          <add        name="messages"
                      type="System.Diagnostics.XmlWriterTraceListener"
                      initializeData="c:\admin.svclog" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>

  <system.serviceModel>
    <diagnostics>
      <messageLogging  logEntireMessage="true" 
                       logMalformedMessages="true" 
                       logMessagesAtServiceLevel="true" 
                       logMessagesAtTransportLevel="true" />
      <endToEndTracing propagateActivity="true" 
                       activityTracing="true" 
                       messageFlowTracing="true" />
    </diagnostics>
  </system.serviceModel>
</configuration>
Unknown's avatar

About erictummers

Working in a DevOps team is the best thing that happened to me. I like challenges and sharing the solutions with others. On my blog I’ll mostly post about my work, but expect an occasional home project, productivity tip and tooling review.
This entry was posted in Development and tagged , , . Bookmark the permalink.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.