Enable WCF message logging/tracing

Place following in the config file:

<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage=”true”
logMalformedMessages=”false”
logMessagesAtServiceLevel=”false”
logMessagesAtTransportLevel=”true”
maxMessagesToLog=”3000″
maxSizeOfMessageToLog=”2000″/>
</diagnostics>

. . .

<system.diagnostics>
<sources>
<source name=”System.ServiceModel.MessageLogging” switchValue=”Information, ActivityTracing”>
<listeners>
<add name=”log”
initializeData=”c:\temp\Traces.svclog”
type=”System.Diagnostics.XmlWriterTraceListener” />
</listeners>
</source>
</sources>
<trace autoflush=”true”/>
</system.diagnostics>

  • Use SvcTraceViewer.exe to view svclog file (visual studio command prompt).
  • Change parameter swithcValue to “Warning, ActivityTracing” when in production!
  • Message will not be placed into the log, if size will be larger than maxSizeOfMessagesToLog (in bytes)!
Advertisements
Posted in WCF. Tags: . Leave a Comment »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: