John
John

Reputation: 1327

ASP.NET MVC Global Error Handling with ELMAH - best practices

I really would like to integrate ELMAH into my MVC4 application but I'm having a few issues:

Upvotes: 1

Views: 5526

Answers (1)

Piotr Stapp
Piotr Stapp

Reputation: 19830

1) Elmah does do any redirects, so you have handle error pages yourself in web.config (hot ot do this you can look here)

2) You should. Elmah is for logging unhandled exceptions. You can log handled exceptions like this:

try
{
    .....
}
catch(Exception ex) 
{
     Elmah.ErrorSignal.FromCurrentContext().Raise(ex); 
}

3) There is a nice article is on Scott Hanselman blog: ELMAH: Error Logging Modules and Handlers for ASP.NET (and MVC too!)

Upvotes: 3

Related Questions