Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elmah is not triggering when custom errors is enabled

When I have my custom errors disabled, Elmah is taking all exceptions that occur and logging them into my database and emailing me.

However, the second I change my web.config to:

<customErrors mode="RemoteOnly" defaultRedirect="~/Home/Error">
</customErrors>

Elmah stops functioning. It no longer logs exceptions to the database or anything, all I see is my custom error action being executed.

How can I have custom error messages and still have elmah log exceptions? I am currently not doing any other exception intercepting besides Elmah.

like image 523
KallDrexx Avatar asked Oct 12 '11 02:10

KallDrexx


People also ask

How do you check Elmah errors?

Build the application, run it in the browser, and navigate to http://www.yoursite.com/elmah.axd. You are prompted to log in before you see the content. After a successful authentication, you see a web page to remotely view the entire log of recorded exceptions.

What is Elmah logging?

In this article ELMAH is a free, open source error logging library that includes features like error filtering and the ability to view the error log from a web page, as an RSS feed, or to download it as a comma-delimited file.


1 Answers

Figured it out!

The reason this was occurring was because I had filters.Add(new HandleErrorAttribute()); in Global.asax. I don't know why this is there, but that was what was causing this to fail when custom errors was enabled. Removing this line caused Elmah to work properly with custom errors.

Also, telling elmah to log "handled" errors also works, as described by this answer.

I don't truely know the full ramifications of either option though.

like image 99
KallDrexx Avatar answered Oct 07 '22 20:10

KallDrexx