What is ELMAH?

ELMAH provide way for logging Error at runtime in a Local/Production environment. ย ELMAH is a open source error logging library/dll that includes features like error filtering and able to ย view the error logs by a web page (localhost:50287/elmah.axd). It would very difficult to track/debug the error after code has been moved to production environment. To avoid this type of difficulties we are using ELMAH for logging.

Note : Theย main purpose of ELMAH it to log all the unhandled exceptions in our application.

Implementing ELMAH in our Application :

STEP 1: Installing ELMAH

Install ELMAH using NuGet, go to Tools -> Library Package Manager -> Package Manager console and type “Install-Package elmah” as shown in below.

Elmah-dotnet-helpers1

STEP 2:

After successfull installation, elmah will add required library in our application and update the web.config file. Verify whether below changes has been updated in the webconfig after the successfull installation.

STEP 3:ย 

Run the application and try to access contoller/action which is not present in our application for tracking the error.
After that includeย elmah.axdย at the end of the url to show the errors which has been caught from starting as shown below.

Elmah-dotnet-helpers2

NOTE : If you not able to access the elmah.axdย page thenย include the below line in Global.asax

RouteTable.Routes.Ignore(“{resource}.axd/{*pathInfo}”);

We will discuss more about ELMAH in upcoming posts.

Keep cool coding…