Logging from ELMAH

This article will explain the steps necessary to log errors from your web application into elmah.io. We also offer more specific guides on ASP.NET MVC, Web API, Nancy and a lot of other web- and logging-frameworks. Read through this tutorial and head over to a tutorial specific for your choice of framework afterwards. If you don’t know ELMAH, check out our ELMAH Tutorial - what is ELMAH and visit the nice folks over at the ELMAH project page. Let’s get started.

Create a new ASP.NET MVC project in Visual Studio (you can choose another web project type if you’d like):

Create ASP.NET MVC Website

Select a project template of your choice:

Select Project Template

Navigate to elmah.io and login using username/password or your favorite social provider. When logged in, elmah.io redirects you to the dashboard. Click on Create new log and name your log:

Create New Log

When created, elmah.io shows you the install instructions. Don’t pay too much attention to the install steps, because the rest of this tutorial will guide you through the installation. Keep the page open in order to copy your API key and log ID at a later step:

Copy your log id

Navigate back to your web project, right click References and select Manage NuGet Packages:

Open Manage NuGet Packages

In the NuGet dialog, search for elmah.io:

Search for elmah.io

Click Install and input your API key and log ID in the dialog appearing during installation of the NuGet package:

Insert your log id

You’re ready to rock and roll. Hit F5 and input a URL you know doesn’t exist (like http://localhost:64987/notfound). You should see the standard 404 message displayed in the browser. To verify that the installation of elmah.io is successful, navigate back to the elmah.io dashboard and select the Search tab of your newly created log:

Error Details

See the notfound error? Congrats! Every error on your application is now logged to elmah.io.


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