Levels of Tracing, Part 4
Today's article continues the series on tracing and message logging with a look at the different message logging configuration options.
1.
Introduction to tracing and trace levels
2. Configuration tracing and trace options
3. Enabling message logging
The options I showed yesterday for message logging included four switches to control which types of messages get logged and two quotas to control how much data is logged.
The four switches are:
- logEntireMessage: whether to log message bodies or just the headers of each message
logMalformedMessages: whether to log the message when there is a decoding error, such as in a message encoder or serializer
- logMessagesAtServiceLevel: whether to log messages when handled as part of a dispatch operation
- logMessagesAtTransportLevel: whether to log messages when handled as part of the network transport (or quite often the message encoder)
All of the switches are set to off by default.
The two quotas are:
- maxMessagesToLog: number of messages to record before messages are dropped rather than logged (you get a trace when this limit is reached)
maxSizeOfMessageToLog: the maximum serialized size a message can have when written out to the trace log (this isn't quite the same as the original message size for a variety of reasons)
The default for maxMessagesToLog is 10000 and the default for maxSizeOfMessageToLog is 256 kilobytes. I don't think the documentation for WCF mentions this anywhere but setting either of these values to -1 should disable the quota.
I've left out one particular option for message logging, which is the filtering system. I'll cover that after compiling some of the behind the scenes details of the options in this article.
Comments
Anonymous
May 17, 2009
Hi Nick In my experiments with WCF message logging, I am able to get complete request logging (with the HTTP headers) but only SOAP envelope response logging. I posted a question on <a href="http://stackoverflow.com/questions/868940/wcf-why-isnt-httpresponse-getting-logged-here">stackoverflow</a> before I saw this post. Any advice? Thank you SriramAnonymous
May 19, 2009
Hi Sriram, It looks like you're doing service level tracing in that example. It's likely that the HTTP headers have not been generated yet. At the service level, I'd only expect to see the HTTP headers that the application provided. The network transport fills in the other HTTP headers later.