alexbeletsky / elmah-mvc

Painless integration of ELMAH into ASP.NET MVC application
http://nuget.org/packages/Elmah.MVC
Apache License 2.0
266 stars 61 forks source link

Errors aren't logged under MVC 4 on .NET 4 #13

Closed troyhunt closed 12 years ago

troyhunt commented 12 years ago

As per the title, ELMAH isn't logging errors for an MVC 4 project running under .NET 4 when custom errors are on. Here's how to repro:

1) Create a brand new ASP.NET MVC 4 web app running on .NET 4 in VS 2012 RC 2) Add Elmah.MVC via NuGet 3) Add an unhandled exception to the index action on the home controller such as "var foo = new Guid("x")" 4) Run the app, hit the error then you'll see it on the ELMAH handler page 5) Turn custom errors on, repeat the previous step and there'll be no error

I also tried registering an exception filter and raising the error on handled exceptions bot no good: http://stackoverflow.com/questions/766610/how-to-get-elmah-to-work-with-asp-net-mvc-handleerror-attribute/5936867#5936867

alexbeletsky commented 12 years ago

@troyhunt thanks for report,

I spend some time on this issue. Actually, I think it's common issue not related to MVC version. Elmah.MVC is very simple package, just one additional controller.

Version 2.0 now contains global filter HandleErrorAttibute which is registered on application start up and log all occured errors. Some little info in this issue.

Anyway, I've tested your case (custom errors = "On") in 2.0 and seems to be handled fine ;)