Possible Duplicate:
elmah: exceptions without HttpContext?
In Global.asax
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
throw new Exception("TEST");
}
// ... other usual methods
}
Elmah
is not logging the exception.
I do quite a bit of initialisation and configuration work in here and it's kinda important that I get error logs if anything goes wrong.
Not sure why it doesn't work but presumably to do with the MVC lifecycle - perhaps there is no HttpContext
at this stage? Is there any way to log errors through Elmah
here?