elmahelmah.mvc

Manually logged ELMAH errors aren't sending email


I'm manually logging certain errors like this:

ApplicationException ex = new ApplicationException("Testing");

Elmah.ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(new Elmah.Error(ex));

The unhandled exceptions are sending email, but the manually logged ones are not. I've also tried this:

Elmah.ErrorSignal.FromCurrentContext().Raise(ex);

How do I get these manually logged errors to send email (without throwing and showing a custom error page)?


Solution

  • I spoke too soon.

    This doesn't send email:

    Elmah.ErrorLog.GetDefault(System.Web.HttpContext.Current).Log(new Elmah.Error(ex));
    

    But this does:

    Elmah.ErrorSignal.FromCurrentContext().Raise(ex);