Custom Logging of Exceptions

Topics: Building and extending application blocks, Exception Handling Application Block, Logging Application Block
Aug 25, 2009 at 9:19 AM


I am using the Exception Handling Block to handle exceptions however now I wish to Log some of them based off the policy and exception type. 

So I  used the Enterprise Library Configuration tool and I added a Logging Handler.

This added the Microsoft Logging Block to be configured however I don't necessarily want this direct dependancy.  In most likelyhood it will use log4net as this is currently used for Auditing purposes within the application.

So I would like to be able to keep the functionality of the Exception Handling but abstract the logging so that I can swap and change relatively easily. Essentially I want to point to a Factory.

Has anyone used the blocks in this fashion?

Many Thanks


Aug 25, 2009 at 9:23 AM

You would need to create a custom tracelistener that will encapsulate the log4net functionality.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.