as part of our pro-active maintenance, we like to log all errors that occur on a website. That way we're informed whenever a user has seen an error and we have all environmental information available (querystring, form values, session vars, etc). We typically do this within the Application_Error function in the global.asax.
With Umbraco, we do have a problem for implementing this, as a lot of XSLT based errors seem to fail "silently" by simply displaying the text "Error parsing XSLT ..." within the page and not throwing the error.
I would actually prefer this to throw the exception, rather than catching it and failing silently. Or have another way to know that an error has occured.
1) I could change the source code for our projects to not catch / re-throw the error, but then we would have to keep our own version of this file which I don't like 2) I could suggest the change as part of the project code, but I might really be the only one out here who thinks that this is a good idea 3) There might be a way to do this that is already foreseen and which I don't know :)
I think it should be possible without changing the core code.
Have you looked at the source code for how the Umbraco debugging trace works? Maybe that will point you in the right direction? It would be interesting to hear what you end up doing with this.
( If you don't know what I mean, add the following to the end of an of your URL's on a page with an XSLT error )
umbDebugShowTrace=true
You might need to change the debug settings on the web.config:
I'm curious if anyone has integrated Log4Net into an Umbraco instance? If so, and if it worked...then that may help solve your problem without editing code.
Silent failures > How to be informed?
Hi,
as part of our pro-active maintenance, we like to log all errors that occur on a website. That way we're informed whenever a user has seen an error and we have all environmental information available (querystring, form values, session vars, etc). We typically do this within the Application_Error function in the global.asax.
With Umbraco, we do have a problem for implementing this, as a lot of XSLT based errors seem to fail "silently" by simply displaying the text "Error parsing XSLT ..." within the page and not throwing the error.
I would actually prefer this to throw the exception, rather than catching it and failing silently. Or have another way to know that an error has occured.
I have located the code in the source where this happens (https://umbraco.svn.codeplex.com/svn/umbraco/umbraco/presentation/macro.cs), but I'm unsure on the best way to solve this.
1) I could change the source code for our projects to not catch / re-throw the error, but then we would have to keep our own version of this file which I don't like
2) I could suggest the change as part of the project code, but I might really be the only one out here who thinks that this is a good idea
3) There might be a way to do this that is already foreseen and which I don't know :)
Any suggestions?
Thanks
Gregory
Hi Gregory,
I think it should be possible without changing the core code.
Have you looked at the source code for how the Umbraco debugging trace works? Maybe that will point you in the right direction? It would be interesting to hear what you end up doing with this.
( If you don't know what I mean, add the following to the end of an of your URL's on a page with an XSLT error )
You might need to change the debug settings on the web.config:
Cheers,
Chris
Hi Chris,
unfortunately, I don't think the debug info will help us much here. In the source code, there's 2 things that are done when the rendering of an xslt fails (taken from https://umbraco.svn.codeplex.com/svn/umbraco/umbraco/presentation/macro.cs):
catch (Exception e)
{
HttpContext.Current.Trace.Warn("umbracoMacro", "Error parsing XSLT " + xsltFile, e);
return new LiteralControl("Error parsing XSLT file: \\xslt\\" + XsltFile);
}
The first thing is what shows up in the trace info
The second writes out the "Error parsing ... " as the result of the macro
So the trace is right there, within the catch()
But clearly, that would be the place to add / change the code... It's just that I don't want to change the source code unless there's no other way :-s
I'm curious if anyone has integrated Log4Net into an Umbraco instance? If so, and if it worked...then that may help solve your problem without editing code.
Lee Kelleher wrote a nice blogpost how to integrate ELMAH into umbraco. You'll find it here
Cheers,
Richard
is working on a reply...