Build status NuGet Samples

Logging from ASP.NET MVC

Even though ELMAH works out of the box with ASP.NET MVC, ELMAH and MVC provides some features which interfere with one another. As usual, the great community around ELMAH have done something to fix this, by using the Elmah.Mvc NuGet package. We've built a package for ASP.NET MVC exclusively, which installs all the necessary packages.

To start logging exceptions from ASP.NET MVC, install the NuGet package:

Install-Package Elmah.Io.Mvc

During the installation, you will be asked for your API key (Where is my API key?) and log ID (Where is my log ID?). That's it. Every unhandled exception in ASP.NET MVC, is logged to elmah.io.

As part of the installation, we also installed Elmah.MVC, which adds some interesting logic around routing and authentication. Take a look in the web.config for application settings with the elmah.mvc. prefix. For documentation about these settings, check out the Elmah.MVC project on GitHub.

Since Elmah.MVC configures its own URL for accessing the ELMAH UI (just /elmah and not /elmah.axd), you can remove the location element in web.config, added by the Elmah.Io.Mvc NuGet package installer.


This article was brought to you by the elmah.io team. elmah.io is the best error management system for .NET web applications. We monitor your website, alert you when errors start happening and help you fix errors fast.

Monitor your website



Comments