10

I have the following configuration in place, but no traces are going into Application Insights (otherwise Application Insights is working fine for other logging and the Azure diagnostics listener is also working and capturing the traces). Am I doing something wrong?

<system.diagnostics>
    <trace autoflush="true" indentsize="0">
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
        </add>
        <add name="myAppInsightsListener" type="Microsoft.ApplicationInsights.TraceListener.ApplicationInsightsTraceListener, Microsoft.ApplicationInsights.TraceListener" />
      </listeners>
    </trace>
  </system.diagnostics>
Ivan Zlatev
  • 11,978
  • 8
  • 38
  • 48
  • Which Application Insights nuget packages are installed? Do you have an ApplicationInsights.config file? – Don Lockhart Sep 06 '16 at 16:26
  • "Microsoft.ApplicationInsights.AspNetCore": "1.0.0", "Microsoft.ApplicationInsights.Web": "2.2.0-beta1", "Microsoft.ApplicationInsights.TraceListener": "2.1.0", "Microsoft.ApplicationInsights.PerfCounterCollector": "2.2.0-beta1" – Thom Sep 08 '16 at 09:36
  • And yes, I have a config file, which is published during build. – Thom Sep 08 '16 at 09:36

2 Answers2

11

I had the same problem.

My steps to resolve after my discussion in the comments here were:

  1. Uninstall all App Insights NuGet packages
  2. Delete ApplicationInsights.config
  3. Install ApplicationInsights.Web
  4. Install ApplicationInsights.TraceListener
  5. Add InstrumentationKey for your App Insights instance to ApplicationInsights.config

Hope this helps.

Liam
  • 126
  • 1
  • 3
  • 3
    You can also try and set the telemetry key programmatically. I like using config transforms to set my Instrumentation key per environment. TelemetryConfiguration.Active.InstrumentationKey = appInsightsKey; – user959729 Sep 07 '16 at 15:53
0

I updated my appinsight nuget packages to latest, which updated ApplicationInsights.config and everything worked fine.

Delete may not be neccessary. Try updating your appinsight nuget packages first without uninstalling the appinsight packages and if does not work then you can do what is accepted as answer.

Karthikeyan VK
  • 3,430
  • 3
  • 26
  • 39