Skip to content

Instantly share code, notes, and snippets.

@sandromello
Created September 25, 2012 21:13
Show Gist options
  • Save sandromello/3784489 to your computer and use it in GitHub Desktop.
Save sandromello/3784489 to your computer and use it in GitHub Desktop.
Log, Trace - C#
<configuration>
<system.serviceModel>
<diagnostics>
<!-- Enable Message Logging here. -->
<!-- log all messages received or sent at the transport or service model levels >
<messageLogging logEntireMessage="true"
maxMessagesToLog="300"
logMessagesAtServiceLevel="true"
logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
</system.serviceModel>
</configuration>
==========
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information,ActivityTracing"
propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\logs\TracingAndLogging-client.svclog" type="System.Diagnostics.XmlWriterTraceListener"
name="xml" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
Source: http://msdn.microsoft.com/en-us/library/ms751526.aspx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment