I'm beginning to use ELMAH in my ASP.NET 2.0 app to capture exception
info to a more manageable format.
It works okay for exceptions that aren't already trapped and handled
anywhere - those are being recorded, and sent to my error reporting
e-mail address just fine.
My question now is: all throughout my app, I have tons of calls to a
central method which currently logs exceptions to a text file. This is
rather hard to handle and not very manageable at all.
What I'd like to do is tap into that central method, and grab those
exceptions into ELMAH, too - with the e-mail being sent and all.
How can I do that? If I can do that at all?
Thanks for any hints / pointers / thoughts!
Marc
You can manually log an error with Elmah with this one-liner:
GotDotNet.Elmah.ErrorLog.Default.Log(new Error(new Exception("your
errormessage here")));
or, if you're catching an Exception called e:
GotDotNet.Elmah.ErrorLog.Default.Log(new Error(e));
-s
- Or -
http://www.gotdotnet.com/workspaces/messageboard/thread.aspx?id=f18bab11
-162c-4267-a46e-72438c38df6f&threadid=e0410198-6e6c-4dc0-8fc7-182c2996a1
d6
Excellent stuff.
Marc