Open GoogleCodeExporter opened 9 years ago
Simplified summary line
Original comment by azizatif
on 21 Aug 2007 at 8:09
This issue still needs to be addressed via perhaps a wiki page, but meanwhile
here
is some new information regarding logging programmatically (yes, cheap
documentation)...
The ErrorSignal class provides a more powerful way of logging errors. See:
http://elmah.googlecode.com/svn/trunk/src/Elmah/ErrorSignal.cs
Calling ErrorSignal.Raise will go through the same set of events as when an
unhandled exception is encountered. In effect, you get logging plus mailing and
even
filtering if that's what's currently configured.
Original comment by azizatif
on 30 Oct 2007 at 9:30
I was doing it as follows. Is there anything wrong with this?
try
{
ds.WriteXml(xml);
}
catch (UnauthorizedAccessException uae)
{
Elmah.SqlErrorLog sqlErrorLog = new Elmah.SqlErrorLog
(Common.Config.strCnn);
sqlErrorLog.Log(new Elmah.Error(uae,
System.Web.HttpContext.Current));
//or even...
throw new Exception(string.Format("Could not write to the file {0},
maybe file is read only", xml), uae);
}
Original comment by abdullah...@gmail.com
on 5 Nov 2007 at 2:13
There is nothing technically wrong with it but you'll be tying in to the
SqlErrorLog
implementation. If you switch to another implementation in your configuration
then
you might be getting half your errors in one log and the other half in another.
It
could be maintenance nightmare to have to go and update your code each time you
change the configuration. The idea with ErrorSignal was to log an exception
explicitly yet using whatever happens to be your current configuration. With
ErrorSignal, you decouple yourself with dependencies on a particular setup.
Original comment by azizatif
on 5 Nov 2007 at 2:31
As of now, one way "to publish an exception to ELMAH
programmatically" seems to be like this...
Elmah.ErrorSignal.FromCurrentContext().Raise(new ApplicationException("my
msg"));
...so that might help.
-- Mark Kamoski
Original comment by mkamo...@gmail.com
on 29 Apr 2009 at 7:57
I'm trying this in v1.1, but I'd like to know if this is the approved way to do
it
Dim elmahError As New Elmah.Error()
elmahError.Message = "Something happened"
elmahError.Time = Date.Now()
Dim elmahErrorLog As Elmah.ErrorLog =
Elmah.ErrorLog.GetDefault(HttpContext.Current)
elmahErrorLog.Log(elmahError)
Original comment by madcoo...@gmail.com
on 12 Oct 2009 at 10:39
@madcookie: Signaling is the more recommended way to go. See:
http://code.google.com/p/elmah/wiki/DotNetSlackersArticle#Signaling_errors
Original comment by azizatif
on 12 Oct 2009 at 10:43
Thank you. This is exactly what I was trying to find. Sorry I couldn't.
Hopefully
others will find what they need because of your response.
I would like to add this link. It lists common exceptions to help those of us
needing
a reminder.
http://blogs.msdn.com/brada/archive/2005/03/27/402801.aspx
Original comment by madcoo...@gmail.com
on 12 Oct 2009 at 11:01
Hi
I've tried this solution on WCF Service and gets:
System.ArgumentNullException: Value cannot be null.
Parameter name: context
at Elmah.ErrorSignal.FromContext(HttpContext context) in
c:\builds\ELMAH\src\Elmah\ErrorSignal.cs:line 67
at Elmah.ErrorSignal.FromCurrentContext() in
c:\builds\ELMAH\src\Elmah\ErrorSignal.cs:line 61
is it not possible to use this method in WCF Service?
Original comment by Cohen.O...@gmail.com
on 6 Dec 2009 at 6:20
Maybe the priority on this needs to go up.
See discussion here:
http://groups.google.com/group/elmah/browse_thread/thread/9ea4b51420fd5dfa
Original comment by jjspr...@gmail.com
on 15 Feb 2010 at 2:22
Can anyone please explain how I can resolve this issue
http://code.google.com/p/elmah/issues/detail?id=30#c9
I'm facing the same problem.
I cant understand anything on this discussion
http://groups.google.com/group/elmah/browse_thread/thread/9ea4b51420fd5dfa
Original comment by ismailsi...@gmail.com
on 8 Jun 2010 at 12:15
Original issue reported on code.google.com by
haac...@gmail.com
on 21 Aug 2007 at 5:06