tags:

views:

132

answers:

2

I have the following node in my system.serviceModel node of my WCF service, but my log definitely gets more than 3 messages written to it:

<diagnostics>
  <messageLogging maxMessagesToLog="3"
          logEntireMessage="true"
          logMessagesAtServiceLevel="true"
          logMalformedMessages="true"
          logMessagesAtTransportLevel="true">
  </messageLogging>
</diagnostics>

Any ideas?

Edit: Actually, my TRACE gets more than 3 messages written to it. I'm assuming there's a difference between log and trace, right?

A: 

Yes they are different. Via Config Editor:

Logging:
1. In the Configuration Editor, select the Diagnostics node.
2. In the right pane, click Enable MessageLogging.
This will create ServiceModelMessageLoggingListener and System.ServiceModel.MessageLogging nodes under the Listeners and Sources folders, respectively.
3. In the left pane, select MessageLogging under the Diagnostics node.
4. Set the LogMessagesAtServiceLevel attribute to True by choosing this option from the drop‐down list.
5. In the left pane, select ServiceModelMessageLoggingListener under the Listeners node.
Note the default value of the InitData attribute, which is set to c:\inetpub\wwwroot\WCFService\web_messages.svclog, the location where the message will be logged.

Tracing:
1. In the Configuration Editor, select the Diagnostics node.
2. In the right pane, click Enable Tracing.
This will create ServiceModelTraceListener and System.ServiceModel nodes under the Listeners and Sources folders, respectively.
3. In the left pane, select ServiceModeTraceListener under the Listeners node. Note the default value of the InitData attribute, which is set to c:\inetpub\wwwroot\WCFService\web_tracelog.svclog, the location where the trace message will be logged.
4. In the Configuration Editor, on the File menu, click Save.

Again from WCF Security Guidance: WCF Message Logging allows you to log malformed Simple Object Access Protocol (SOAP) messages or to trace incoming messages. It allows you to specify different logging levels that you can use to diagnose and analyze your applications in case of any problems.

RandomNoob
Is there a way to limit the number of messages saved to the trace?
A: 

Where do these logs go? How can you define that?

kg2
http://msdn.microsoft.com/en-us/library/ms733025.aspx - Take a look at the first section of XML.