Evil Dev's Blog

Plots, Schemes, and Plans to take over the Devleoper world.... Mu hahahaha


News

For all those who are interested, the .NET User Group Meetings here in Winnipeg are starting up again next Thursday, check out Winnipeg's .Net user group Home Page for details.

My Stats

  • Posts - 14
  • Comments - 13
  • Trackbacks - 0

Recent Comments


Recent Posts


Article Categories


Archives


Post Categories


Blogs I Like


Cool Sites



Well, my logging framework is pretty solid I think, still needs further practical testing, but so far working alright.

Today, a co-worker proposed a challenge to me, in the form of a general comment. He mentioned how our current error logging framework at work functioned (we use ELMAH). Which got me thinking.

ELMAH works, by implementing an HttpModule, which catches web applications "OnError" event if you will, logs them and lets the app go on it's merry way.

Digging into HttpModules, I discovered that kind of functionality is extremely easy to implement, so I've added a new class to my framework called "HttpErrorLoggingModule" that implements the IHttpModule interface.

There's not much code, so if your interested just pull down the source of codeplex and dig into it.

I also enhanced my "GenericLogger" so now when logging errors it'll do a recursive write of all inner exceptions as well, and it checks if the Exceptions "Data" property contains anything, and write out all those values as well.

The reason I did this, is so my HttpErrorLoggingModule could then append data about the Current HttpContext to the exception itself to be logged, similar to the way Elmah records that stuff.

I know, why don't I just use Elmah? Partially because I've found with working with it, that there are some shortfalls, specifically, if there's a weird low impact exception being thrown, but it's thrown every minute or so, if an issue is already logged related to that exception it should not be spamming me with email. By building a similar module ontop of my own framework, I open that kind of flexibility up.

Plus, the core code is only like 30 lines long (if that), so it's not exactly complicated.
So if your interested, it's up on CodePlex here: http://mitchweb.codeplex.com/


Anyone, I'm going to challenge you my readers with something as well, cause for the life of me, I don't know how to do it.

I want to add this kind of functionality to my framework, for Console/WinForms/WPF applications as well, something that preferably wouldn't require a recompile of the client application, and could be setup merely by copying dll's and adding some configuration. I know it's easy enough to instantiate an error event handler in the main access point of the application, but I'm wondering if there's a way to do it without touching the client, like Elmah. Any help I'd greatly appreciate :)

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati