How to log additional info with .HandleException() ?

Topics: Exception Handling Application Block
Jun 3, 2011 at 6:00 AM

Hi guys,

I'm implementing exception logger for ASP.NET MVC application using ExceptionHandling Block.I need to log additional information with error (request string, user agent, etc..).

I tried to add to as Exception.Data but discovered that TextExceptionFormatter does not handle this field correctly. It logs this property as Data : System.Collections.ListDictionaryInternal.

Should I implement custom formatter or there is better way to do this?

 

Thanks

Jun 3, 2011 at 6:55 AM

Please disregard this thread. It was issue in my code.

Passing additional info as .Data dictionary works good.

Jun 3, 2011 at 7:25 AM

Hi,

If I understand correctly your scenario, you are adding collection object to the Exception.Data? Out of the box, I believe the Formatter will try to convert the values to string. Possible workaround I can think of here is to pull out the data from your collection object and add it one by one to the Exception.Data or create a custom formatter and pull out the data there.

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com