Intermittent AI Logging RRS feed

  • Question

  • We have an MVC.Net Azure solution that uses Log4Net's AppInsights appender. Initially it seemed to be intermittent, but there is consistency of failure.

    In a vain attempt to isolate issues we are experiencing with information not being logged, we extended the logging to additionally, explicitly call TelemetryClient.TrackTrace. In development environments, both Log4Net and direct TelemetryClient calls work every time without issue.

    In Azure we have two web apps, both built using the .Net MVC solution, each with two deployment slots (with different telemetry keys per web app per slot). In App Insights instances data points are below quota, using a paid pricing tier with the quota cap removed. Yet both web apps behave differently, and we have slight differences per slot, as per:

    1) In one web app:
    a) In Synchronously executed code, the TrackTrace calls log to AppInsights, but the Log4Net calls do not (for each slot)
    b) In Asynchronously executed code neither TrackTrace nor Log4Net log to AppInsights
    2) On the other web app:
    a) In Synchronously executed code:
    i) On one slot, the Log4Net calls log to AppInights, but the TrackTrace calls do not (for each slot)
    ii) On the other slot, the Log4Net and TrackTrace calls both log to AppInights. Except in one slot the Log4Net calls do not log when executed from the context of HttpPost
    b) In Asynchronously executed code the Log4Net calls log to AppInsights, whereas the TrackTrace calls intermittently log to AppInsights

    When analysing AppInsights, we have waited 15 minutes before checking what is logged, then re-checking a few hours later to sanity check.

    In all web apps, ApplicationInsights is initialized via ApplicationInsights.config file.

    We added file logging to prove that AppInsights calls were not failing, and that the InstrumentationKey was initialized correctly.

    As an interim measure we are logging to AppInsights directly *and* via Log4Net. In this manner we get around 80% of events logged.
    Wednesday, November 16, 2016 6:02 PM