Quick Tip: How to manually add a log entry in ELMAH

Quick TipI’m a big fan of Elmah (even though I’m still a little more partial to log4Net) since it gives you a very quick way of logging all unhandled exceptions in your application. However, sometimes you need to manually add an entry (say within a try/catch block) and fortunately Elmah provides a simple way to do that.

I should have looked through StackOverflow sooner, but here it is. Add this one statement in your catch block (or anywhere else really) and you can get a log entry into Elmah, and let your code continue as planned:


That’s all! Happy logging!



What are your 10 bits on the matter? I want to know!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s