Hi, I wonder if anyone could help me with the enterprise library (3.1) exception handling and logging. I am trying to add Extended properties to a exception. I have worked out that that I can add extended properties to a LogEntry and this works well, however I cant seem to figure out how to add my own extended properties to an exception?
The following code which works really well but as you can guess I am receiving two notifications, one from the logger and one from the exception when really all I am trying to do is receive a single notification with the error and my own extended properties.
Try
Throw New Exception("A handled exception")
Catch ex As Exception
Dim logEntry As LogEntry = New LogEntry()
logEntry.ExtendedProperties.Add("Collections", MyError.ProcessError(ex))
Logger.Write(logEntry)
HandleException(ex, "GlobalPolicy")
End Try
Note the method MyError.ProcessError(ex)) returns a string of all ASP.NET collections i.e. cookies, querystring, form, session