Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Jul 03, 2015 @ 10:41
    Ismail Mayat
    0

    Examine IndexingError with Elmah

    I am in OnApplicationStarted wiring up examine indexingerror event so I have code like

    private void OnIndexingError(object sender, IndexingErrorEventArgs indexingErrorEventArgs)
       {
           //Was a problem indexing node XX
           var ex = new Exception("Examine Index Error from node:" + indexingErrorEventArgs.NodeId, indexingErrorEventArgs.InnerException);
    
           //Push this exception upto ELMAH logs
           Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
       }
    

    My question is when i do the elmah will i get another error because i wont have httpcontext?

    Regards

    Ismail

  • elmah.io 1 post 42 karma points
    Jul 03, 2015 @ 10:46
    elmah.io
    100

    When logging errors to ELMAH ouside a HTTP context, you should use the Log method instead:

    Elmah.ErrorLog.GetDefault(null).Log(new Error(ex));
    
  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Jul 03, 2015 @ 10:49
    Ismail Mayat
    0

    Cheers Elmah now this is awesome customer service.

Please Sign in or register to post replies

Write your reply to:

Draft