ASP .Net MVC Error Logging Using Elmah
ASP .Net MVC Error Logging Using Google Elmah
ELMAH is one of the popular Library to logging unhandled errors provided by Google .It’s an application wide error logging facility which can be dynamically plugged. You don’t need to recompile the code. It’s pluggable. Below I will show you how to log your errors using elmah without having to write even one line of code. More over when you deploy it on a server you can remotely view the errors.
In this blog I am explaining how to use Elmah in MVC application.
Step1: Open your MVC application solution.
Step 2: Add the packages for Elmah using NuGet Packages.
Right click on the project ->select Manage NuGet Packages
Step 3: Search for Elmah
Install Elmah Core Libary & Elmah.Contrib.MVC
Click on Close after installation
Step 4: Build solution and Run
And follow URL with your port number as show below and you will get logged errors.
Advantages of using Elmah:
- Serves a purpose of tracking errors and exceptions for your web applications
- Allows you to easily log or view those exceptions via many different mechanisms (sql, rss, twitter, files, email, etc).
- If you have no built in exception handling Elmah will most likely get you what you are looking for in terms of exception handling in a web application environment.