Tracing in wcf service enabled developers to get logged information about events. Only config settings can enable tracing in wcf.
Below given are trace levels, combination of these trace levels can be used for 'SwitchValue' attribute of Source element.
Below given are trace levels, combination of these trace levels can be used for 'SwitchValue' attribute of Source element.
- Critical
- Error
- Warning
- Information
- Verbose
- Activity Tracing
- All
Common listener file can be used for different configured traces sources.
Commonly used is System.ServiceModel
Commonly used is System.ServiceModel
- System.ServiceModel: Logs all stages of WCF processing, whenever configuration is read, a message is processed in transport, security processing, a message is dispatched in user code, and so on.
- System.ServiceModel.MessageLogging: Logs all messages that flow through the system.
- System.IdentityModel
- System.ServiceModel.Activation
- System.IO.Log: Logging for the .NET Framework interface to the Common Log File System (CLFS).
- System.Runtime.Serialization: Logs when objects are read or written.
Config Settings:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior >
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<diagnostics>
<messageLogging logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true"
logMalformedMessages="true" maxMessagesToLog="20000" maxSizeOfMessageToLog="10000">
</messageLogging>
</diagnostics>
</system.serviceModel>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Error, Critical" >
<listeners >
<add name="log" initializeData="E:\TracedLog.svclog" type="System.Diagnostics.XmlWriterTraceListener"></add>
</listeners>
</source>
</sources>
</system.diagnostics>












