Use WCF Message Logging

**The post based on How to enable WCF tracing article
**Open WCF Service Configuration Editor under VS 2008 Tools menu   or directly from installation folder (typically C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin\SvcConfigEditor.exe - subfolder v6.0 can be different depending on which version of Windows SDK has been installed)

To enable WCF message logging

  1. Click the Diagnostics node, and expand it.

  2. Enable Message Logging on the right Tab

  3. To edit Message Logging settings, click the Message Logging node. You can edit the settings in the property grid.

  4. In particular ensure that MaxSizeOfMessageToLog is big enough to log all your messages.

The possible options are described in Enabling Message Logging and Recommended Settings for Tracing and Message Logging. I found that it is usually good to set

         logMessagesAtServiceLevel="true"
         logMessagesAtTransportLevel="false"

Otherwise you see 2 duplicate entries logged at different levels.
 

To view trace file: 

Start Service Trace Viewer Tool (typically located at "C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SvcTraceViewer.exe"). 

Open message trace file, that was configured in WCF Service Configuration Editor previously(usually located in the root of your application).

 Select Message View tab, scroll to the bottom and click one of latest messages.If required press F5 to refresh list.

 In the Detail Pane (the bottom right pane in the view) use  Message  tab to see actual messages. 

If you need to trace WCF on Machine, where no Visual Studio/SDK installed, you can just copy SvcConfigEditor.exe and SvcTraceViewer.exe to the folder of your choice and run them without any

additional dependencies.

BTW, I've submitted MS Connect suggestion to Add items "Save Message As" and "Print Message" to Detail Pane

This article is part of the GWB Archives. Original Author: Michael Freidgeim

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.