WCF offers Tracing capabilities, but are turned off by default. To make use of WCF Tracing you will need to turn on the feature and make a few configurations to the .config files of the modules that you would like to trace.
Enabling Tracing via Service Configuration Editor
- In Visual Studio, open the solution that contains the projects that you would like to trace
- Right-click a .config file of a project that you want to trace, then select “Edit WCF Configuration”
- In the Service Configuration Editor, open the Diagnostics directory then click the “Enable MessageLogging” and “Enable Tracing” links
- Click the “ServiceModelMessageLoggingListener and ServiceModelTraceListener links, then choose where you want the logs to be saved.
- Click the “Message Logging” item in the left menu, then specify which messages you want to log
- Open the “Sources” directory, click the “System.ServiceModel” and “System.ServiceModel.MessageLogging” sub items, then set the “Trace level:” to Verbose (or whatever level you want)
- Save the configuration, then take a look at the .config file
You will want to enable Tracing and Logging on each .config file that you want to view logs for.
To view the logs, go to the path that you defined in Step 4.