I've just started working on a brownfield ASP.NET 2.0 Web Application. As with a lot of brownfield applications, the architecture, and specifically the exception logging architecture, is inconsistent and in some places, missing or incorrect (swallowing exceptions, re-throwing, using them for control logic etc)
As a starting point for bringing all of this under control, I'd like to just do a blanket catch all of EVERY exception being thrown in the application, and log it away somewhere like a DB table. Unfortunately to explicity code that into the app would be many days and probably weeks of work, so that rules out hand coding things (eg. putting logger.log(ex) everywhere) and things like log4net and nlog. What I'm looking for another, more light-weight solution to the problem.
After some quick reading on here, I've come across various techniques like:
- Aspect Oriented Programming, such as
- Attribute-based
- Post Sharp library
- Microsoft Unity
- Castle Unity
- Web Handlers
- ELMAH
- Others?
What have people's experiences been with these solutions? Bearing in mind that I'd like to implement this as simply and painlessly as possible, so bells and whistles aren't required at this stage. All I need is something that will report every exception to a single location so I can start finding holes in the logic.
EDIT:
I should probably make it clear that I want to log **ALL** exceptions (even the ones that are handled, as some are handled incorrectly). Is it possible to configure Elmah to do this? If not, what are my other options?