I have a WCF Service which is currently in Production. The code performance are not where we would like them to be and we are unable to reproduce in our Staging environment.
I was wondering if it is possible to log every single method call made to the service and by the service. Essentially I would like a sequential list of all the calls and time stamps (our code isn't multi-threaded).
Is there a way to achieve that without having to instrument the binaries. Is there a level of tracing under the system.diagnostic node in the web.config that we could change?
Have you configured tracing in your configuration file? This is a good article on the subject.
Here is a sample configuration you can use and modify for your needs:
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="ServiceModel"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\ServiceModel.svclog" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="MessageLogging"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="C:\MessageLogging.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="True"
logMalformedMessages="False"
logMessagesAtServiceLevel="True"
logMessagesAtTransportLevel="False"
maxMessagesToLog="10000"
maxSizeOfMessageToLog="10000" />
</diagnostics>
</system.serviceModel>
Use the Service Trace Viewer Tool (SvcTraceViewer.exe) to view the resulting logs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With