What is ELMAH?
ELMAH stand for Error logging Modules and Handlers. 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.
For More Info ELMAH
Advantage:-
·
You can log almost all unhandled exceptions in
the system.
·
An email notification of each error occurs.
·
You can insert log a various locations like
files text file, SQL Server, Oracle etc.
In this blog I am explaining how to use Elmah in MVC
application.
Step 1:-ELMAH NuGet
Package:
There is a nuget package also available for ELMAH. You can
find at following link.
http://www.nuget.org/packages/elmah.mvc/
and Following Command you have to run for installing NuGet
Pacakge.
Install-Package Elmah.Mvc
Step 2:- Now open web
config file and add the following code inside <system.web>
< httpHandlers
>
< add verb =
"POST,GET,HEAD"path = "elmah.axd"type =
"Elmah.ErrorLogPageFactory, Elmah" / >
< /httpHandlers>
Also, add the
following code inside <system.webServer>
< handlers
>
< add name =
"Elmah"verb = "POST,GET,HEAD"path =
"elmah.axd"type = "Elmah.ErrorLogPageFactory, Elmah" /
>
<
/handlers>
Step 3:- Build
solution and Run. if you go to http://yoursite.com/<PageName>.For example http://localhost:51873/Cart.Here Cart page is not exits. So it gives error 404 page not found.
Step 4:- Then go to http://yoursite.com/elmah.
Then it gives error of that page not fount with date and time. Look at that
below.
Download Code Here...
Hope you like it.
Stay tuned for more..
Comments
Post a Comment