Dot Net Tricks

Articles about .NET, ASP.NET, C#, Object Oriented Programming and Agile Methodologies
Welcome to Dot Net Tricks Sign in | Join | Help
in Search

Drew's digital booze

Error Logging Modules and Handlers for ASP.net 2.0

What is Error Logging Modules and Handlers?
Error Logging Modules and Handlers (ELMAH) was introduced by Atif Aziz in 2004 for ASP.net 1.0.  ELMAH is an component library that makes it easy for developers to instrument their applications with excellent error handling capabilities.  By simply adding the dll to your bin directory and adding the necessary elements to your web.config, you can have ELMAH up and running in no time, with no additional changes to your code.  My favorite feature is the fantastic email you get when an error occurs, complete with all server variables and an attachment with what the original page looked like in it's error state!  Atif's site is here, and the original code project on GotDotNet is here

This upgrade makes ELMAH fully compliant with the ASP.net 2.0 runtime.  Of course the original code will still work, but this upgrade will compile on the 2.0 runtime without any warnings, and the reliance on CDONTS for mailing errors has been removed and replaced with System.Net.Mail objects.

How does ELMAH work?
ELMAH wires itself to the application's OnError event and uses HttpModules to send error messages to your designated destinations such as email or database.  It also uses an HttpHandler so that you may view the messages online at your website.  To read more about HttpModules and HttpHandlers, see here

Why Should I Use ELMAH?
ELMAH is by far the easiest logging solution I have found.  It's much easier to understand and configure than log4net, and it doesn't require any changes to your code base.  All you do is configure ELMAH, it's that simple.

Enjoy!
:D

Published Tuesday, April 18, 2006 6:04 PM by Mistercain
Attachment(s): ELMAH2.zip

Comments

 

Fregas said:

Way to go drew.  Robert is a SLACKER.
April 20, 2006 12:46 PM
 

Fez said:

Isn't Elmah the name of Fez's mom?
May 1, 2006 5:58 PM
 

sadath75 said:

cannot find the attached zip file in this post
May 8, 2006 12:54 PM
 

Mistercain said:

Sorry for the trouble, the attachment is now working.
May 9, 2006 8:47 PM
 

slolife said:

I cannot access the download/attachment.  Is it broken again?
May 23, 2006 7:01 PM
 

Fregas said:

H slolife.  I'm working on figuring out why that attachment goes away.  For now, PM Drew and ask him to email it to you:

http://dotnettricks.com/forums/AddPost.aspx?ForumID=0&UserId=2103

May 23, 2006 10:27 PM
 

AStorm said:

I have been trying to download as well without luck.  Could I get it sent to me as well?
Thanks
May 24, 2006 7:23 AM
 

Mistercain said:

Try this alternate location.  If not, send me a PM and I will email it to you.

http://dotnettricks.com/files/72/download.aspx
May 24, 2006 7:50 AM
 

AStorm said:

That worked, Thanks
May 24, 2006 8:56 AM
 

EricSch said:

Thanks for your work.
Could you submit your code to the GotDotnet ELMAH workspace?
This way you would support the community.

Thanks
Eric
May 30, 2006 4:26 PM
 

Mistercain said:

I'm currently working to get this posted to either GotDotNet or CodePlex.  Should have something there in the next day or so.
May 31, 2006 1:31 PM
 

Mistercain said:

May 31, 2006 6:29 PM
 

davidvogt said:

Your article is very informative and helped me further.

Thanks, David
February 3, 2007 4:47 PM
 

Software Theosophy said:

When you're writing code in an asp.net page (or any other type of page) you often come across situations...
December 6, 2007 7:48 PM
Anonymous comments are disabled

This Blog

Post Calendar

<April 2006>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

Syndication

Powered by Community Server, by Telligent Systems