healthMonitoring trace events not written to appharbor log

rgrmrtn's Avatar

rgrmrtn

01 Jun, 2016 10:00 PM

I added a <healthMonitoring> section to <system.web> configuration in my application. Details copied from
https://support.appharbor.com/kb/tips-and-tricks/tracing

However, I do not see health monitoring events in the app harbor log when I start a log session through the app harbor web admin. I am expecting to see at least unhandled exceptions.

My app is "GoFast" and the following URL will intentionally generate an unhandled exception:
http://gofast.apphb.com/Home/TestError

Note, I have trace level set to All, and all checkboxes ticked in the log session filter.

Note, when I add a TextWriterTraceListener under <system.diagnostics> I can see the health monitoring events in my log file when I run locally.

Note, also, when a call say System.Diagnostics.Trace.TraceWarning() directly from my app, say from a controller action, I do see the trace in the app harbor log session.

Note, when I add tracing by hand into my web app's Application_Error handler I have a similar problem - appears in my local trace file but not in the app harbor log session.

And final note - I have seen in a few places (like https://blog.appharbor.com/2011/03/28/application-errors, http://stackoverflow.com/questions/9730068/how-can-i-log-unhandeled-exception-in-appharbor) that app harbor logs application errors, but my unhandled exceptions are not showing up under Errors either.

Any help or advice appreciated.

thanks,
Roger

  1. Support Staff 1 Posted by rune on 02 Jun, 2016 06:45 AM

    rune's Avatar

    Hi Roger,

    AppHarbor can only log unhandled exceptions emitted by the application and the test error page you linked to is actually handling the exception; In all likelyhood it's being handled by the HandleErrorAttribute filter, which by default will show the error message. Take a look at my response in this discussion for more information.

    With regards to the Health monitoring/tracing configuration I took a look at the web.config and noticed that the trace event provider configuration appears includes an HTML encoded line feed. I'm not sure if this is accepted, but you might want to try and remove it. Here's the relevant element (note the encoded value after the type declaration): <add name="TraceEventProvider" type="System.Web.Management.TraceWebEventProvider,&#xA; System.Web,Version=4.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />

    If that doesn't help it'd be great if you could try and push a build that doesn't include the listener configuration (that configures indentation and adds/removes listeners).

    Best,
    Rune

  2. 2 Posted by rgrmrtn on 04 Jun, 2016 05:25 PM

    rgrmrtn's Avatar

    Thanks for your help Rune. Working now.

    >> AppHarbor can only log unhandled exceptions emitted by the application
    and the test error page you linked to is actually handling the exception

    This was useful in explaining why I wasn't seeing exceptions under Errors.

    It also helped me figure out why my exception was not appearing in the AH
    log session — my mistake: Locally I was running, well locally, and my
    <customErrors> mode was not set, defaulting to RemoteOnly. This is used by
    the HandleErrorAttribute filter telling it to not handle my local requests.
    End result: locally my exception was not handled and so was traced by
    healthMonitoring, while remotely (hosted on AH) my exception was handled,
    and therefore was not traced by healthMonitoring.

    (line break in config and trace listener config I think not a problem).

    thanks again.
    Roger

  3. Support Staff 3 Posted by rune on 05 Jun, 2016 04:20 AM

    rune's Avatar

    Hi Roger,

    OK great, thanks for the feedback and I'm glad to hear you figured out a solution!

    Best,
    Rune

  4. rune closed this discussion on 05 Jun, 2016 04:20 AM.

Discussions are closed to public comments.
If you need help with AppHarbor please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac