Topics: Exception Handling Application Block, General discussion
Feb 26, 2007 at 1:13 PM
I am using XmlExceptionFormatterType, to log the exceptions in the event log, now, how can i get this xml exception in my application?

thank you...
Feb 26, 2007 at 3:17 PM
Are you asking how you catch Exceptions in an application? You typically would use a try/catch block to catch an exception and then based on your logging policy decide if you want to log and/or rethrow it.

I recommend you check the Enterprise Library Documentation for 2.0 which has great examples on how you use the Exception Handling Block to log exceptions under

Exception Handling Application Block -> Developing Using the Exception Handling Application Block -> Key Scenarios -> Logging an Exception.

Here is a snippet of code pulled from the documentation:

  // Run code.
catch(Exception ex)
  bool rethrow = ExceptionPolicy.HandleException(ex, "Logging Policy");
  if (rethrow)




David Hayden
Microsoft MVP C#
Feb 26, 2007 at 6:30 PM
I know how to use the exception block, what i ment is, i configure the exception policies to log the error in event log, so, the error that logged in the event log is in: xml format, because i configured the FormatterType to XmlExceptionFormatterType, and i wanted to know how can i get this xml exception(the string of this exception that logged in xml format), i want to assign it to XmlDocument, and print it to the screen??

thank you...