In this tutorial, you will find a step by step instruction how to add ELMAH (Error Logging Modules and Handlers for ASP.NET) to your existing ASP.NET MVC application. ELMAH is an easy-to-plug in library that logs and reports unhandled exceptions in ASP.NET application. It is described as follows:
ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.
I’ve tested the steps below with ASP.NET MVC 2 and ASP.NET MVC 3 applications, but they may work also for other types of ASP.NET applications.
First you have to download ELMAH from the download page. After adding a reference to Elmah.dll in your project, all you have to do is to add the ELMAH configuration to your Web.config.
The example configuration shown above includes two customizings I found very useful for web applications:
- If the server returns a status code between 400 (included) and 500 (excluded), ELMAH ignores the exceptions.
- A remote access to the /elmah.axd web interface is enabled for specific (admin) users.
[...]
[...]
[...]
[...]
[...]
[...]
One response to “ASP.NET MVC: How to add ELMAH (Error Logging Modules and Handlers for ASP.NET)”
[…] on server side and which works perfectly in combination with the approach shown above. I wrote a blog post about how to set up and configure ELMAH in a ASP.NET MVC application.Related posts:ASP.NET: Prevent […]