How to log FaultException

Topics: Exception Handling Application Block, Logging Application Block
Jul 28, 2008 at 3:59 PM
I need to log FaultException, but XmlExceptionFormatter, for example, don't log Code property. I can create my formatter derived from XmlExceptionFormatter. Does exist standart solution?
Jul 28, 2008 at 11:15 PM

The XmlExceptionFormatter will log the result of evaluating ToString() on each of the exceptions' properties. In the case of a FaultException, the Code property will indeed be logged but since the FaultCode class doesn't implement the ToString() method the default string showing the class name will be used instead of something more informative; is this the behavior you're getting? If you need a different outcome, which will likely need to traverse the object graph, you will need a custom formatter.