Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.


AppHarbor supports tracing log messages to your application's log stream from background and web workers. This allows you to effortlessly log messages using built-in .NET tracing features. The tracing integration builds on ETW (Event Tracing for WIndows), so you can also integrate directly with that using injected event provider id.

Application performance is unaffected by the delivery of log messages as this takes place completely out of process. Note however messages are buffered for about a second and that some messages may be dropped if you’re writing excessively to the trace output.

You can set the current trace level on the application's Logging page. There are currently 4 trace levels available: All, Warning, Error and None. Updating the trace level will dynamically update the tracing configuration without redeploying or restarting your application.

Trace messages are automatically associated with the worker emitting them allowing you to filter and diagnose individual workers.

Below are a few examples of how to use tracing in your application.


When tracing is enabled, AppHarbor configures your application with an EventProviderTraceListener as a default trace listener. This means you can use the Trace class without any configuration to trace messages to your log:



var traceSource = new TraceSource("AppHarborTraceSource", defaultLevel: SourceLevels.All);
traceSource.TraceEvent(TraceEventType.Critical, 0, "Foo");

NLog target

    <target xsi:type="Trace" name="String" layout="Layout" />

log4net TraceAppender

<appender name="TraceAppender" type="log4net.Appender.TraceAppender">
    <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />

Using ASP.NET healthmonitoring

With ASP.NET health monitoring you monitor the status of your application and track a number of different events. You can find supported events and configuration details in this article.

This example configuration will trace all unhandled exceptions as well as trace application lifecycle events (application start/stop etc):

<healthMonitoring enabled="true" heartbeatInterval="0">
        <add name="TraceEventProvider" type="System.Web.Management.TraceWebEventProvider,
            System.Web,Version=, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
        <add name="Trace" minInstances="1" maxLimit="Infinite" minInterval="00:00:00" />
        <remove name="All Errors"/>
        <add name="All Errors"
            eventName="All Errors"
            custom="" />

        <remove name="Application Events"/>
        <add name="Application Events"
            eventName="Application Lifetime Events"
            custom="" />


You can integrate directly with ETW (Event Tracing for Windows).aspx). An event provider id is generated per-worker and is injected in your appSettings. You can retrieve it like so: