How can I configure message logging in a C# WCF application?

Posted: (EET/GMT+2)

 

By default, WCF client or server applications don't do any logging. However, especially on the client side, it is often useful to log messages that your application sends and what the server response. For example, you could be debugging an older SOAP based system, and wanted to see the actual messages.

To enable logging in WCF applications, use the System.ServiceModel.MessageLogging trace source, and then also add the "messagelogging" element to your application's XML configuration file.

For more details, Microsoft has provided a nice documentation for all the required options, see the link above.