Use message logging to log operations on your service

J.D. Meier, Jason Taylor, Prashant Bansode, Carlos Farre, Madhu Sundararajan, Steve Gregersen.

Enable message logging to log the messages processed by your service. Message logging is not turned on by default. Turn on message logging by setting attributes on the <messagelogging> element in your configuration file and add a trace listener to log the events to a file.
Message logging is important feature which can be used for diagnosing your applications and analyzing in case of any problems.
The <messagelogging> element allows you to specify the following logging levels:
  • logEntireMessage. Allows you to specify whether just the header should be logged or both header and body.
  • logMalformedMessages. Allows you to see any messages that were rejected by the WCF stack due to validation errors. This can help you determine if someone is attacking your service with poorly formed SOAP messages.
  • logMessagesAtServiceLevel. Logs messages just before or after they are processed by user code.
  • logMessagesAtTransportLevel. Logs messages just before or after they have been transmitted on the wire.
  • maxMessagesToLog. Allows you to limit the size of the log file, by reducing the total number of messages in the log. This setting can be used to reduce the chances of a denial of service attack on your log but can be used by an attacker to fill up the log and cover their tracks.
  • maxSizeOfMessagesToLog. Allows you to limit the size of the log file, by restricting very large messages from being logged. This setting can be used to reduce the chances of a denial of service attack on your log but could potentially be used by an attacker to cover their tracks by ensuring that certain messages are not logged.
Important : Make sure you limit the number of messages that are written to disk for a particular service, as disk space could be limiting factor. When the message limit is reached, a trace at the Information level is produced and all message logging activities stop.

Last edited Apr 24, 2008 at 12:11 AM by prashantbansode, version 2

Comments

No comments yet.