Copied to clipboard

Flag this post as spam?

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


  • Gregory Heeren 9 posts 29 karma points
    Nov 16, 2009 @ 09:47
    Gregory Heeren
    0

    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

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 16, 2009 @ 10:40
    Chris Houston
    0

    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 )

    umbDebugShowTrace=true

    You might need to change the debug settings on the web.config:

    <add key="umbracoDebugMode" value="true" />

    Cheers,

    Chris

  • Gregory Heeren 9 posts 29 karma points
    Nov 16, 2009 @ 11:14
    Gregory Heeren
    0

    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

  • Chad Rosenthal 272 posts 474 karma points
    Nov 16, 2009 @ 14:15
    Chad Rosenthal
    0

    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.

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Nov 16, 2009 @ 16:34
    Richard Soeteman
    2

    Lee Kelleher wrote a nice blogpost how to integrate ELMAH into umbraco. You'll find it here

    Cheers,

    Richard

Please Sign in or register to post replies

Write your reply to:

Draft