ExceptionHandling with Logging without .config file?

Topics: Exception Handling Application Block
Jul 5, 2007 at 8:37 AM
Hi everyone,
i need a little help. So im trying to creat an exception policy with logging without using *.config file. Im using all the classes i need like : TraceListener, TextFormatterData, EmailTraceListenerData etc., but my problem is that i dont know the steps(the algorithm) for creating a policy without the *.config file? Can somebody help me? Which is the right way for this operation?
Thank you in advance!
Jul 5, 2007 at 3:06 PM

You can take a look at the unit tests for the involved classes for details, but you basically want to create this chain of objects:

--> built with a Dictionary<Type, ExceptionPolicyEntry> (keys are exception types, can be base type)
-------> entires built with a PostHandlingAction and an ICollection<IExceptionHandler>

You'll need to use the LoggingExceptionHandler as one of your handlers if you want to log. All the classes take the necessary collaborators as paramters in their constructors.
You won't be able to use the ExceptionPolicy facade as it relies on configuration.

Hope this helps,
Jul 6, 2007 at 6:38 AM
Thanks for the help fsimonazzi, but already found what i neeed :))) : http://davidhayden.com/blog/dave/archive/2006/02/18/2805.aspx