Configuring traces in WCF service
Some times we fail to find what could have caused our WCF service to fail. This can be easily tracked by powerful tracing feature which can be enabled in config file. Traces can be viewed in Trace file viewer which comes with windows sdk elegantly.
For enabling trace use following in WCF service config:
The path "C:/Log/" should exist on disk.
You can also specify what type of messages you want to log using
For enabling trace use following in WCF service config:
<system.diagnostics> <sources> <source name="System.ServiceModel" switchValue="Warning, ActivityTracing" propagateActivity="true"> <listeners> <add type="System.Diagnostics.DefaultTraceListener" name="Default"> <filter type=""/> add> <add name="ServiceModelTraceListener"> <filter type=""/> add> <listeners/> source> <sharedListeners> <add initializeData="c:\wcfLogs\SomeService\app_tracelog.svclog" type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="ServiceModelTraceListener" traceOutputOptions="Timestamp"> <filter type=""/> <add/> sharedListeners> system.diagnostics>
The path "C:/Log/" should exist on disk.
You can also specify what type of messages you want to log using
<diagnostics> <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true"/> diagnostics>
inside "ServiceModel" tag.
Hope this helps!!!
Comments
Post a Comment