【问题标题】:Application Insights TraceListener is not collecting traces?Application Insights TraceListener 未收集跟踪信息?
【发布时间】:2015-10-28 14:35:00
【问题描述】:

我有以下配置,但没有任何跟踪进入 Application Insights(否则 Application Insights 对其他日志记录工作正常,并且 Azure 诊断侦听器也在工作并捕获跟踪)。我做错了吗?

<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>

【问题讨论】:

  • 安装了哪些 Application Insights nuget 包?您有 ApplicationInsights.config 文件吗?
  • “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"
  • 是的,我有一个配置文件,它在构建期间发布。

标签: azure system.diagnostics azure-diagnostics azure-application-insights


【解决方案1】:

我将我的 appinsight nuget 包更新到最新版本,它更新了 ApplicationInsights.config,一切正常。

可能不需要删除。首先尝试更新您的 appinsight nuget 包,而不卸载 appinsight 包,如果不起作用,那么您可以执行被接受的答案。

【讨论】:

    【解决方案2】:

    我遇到了同样的问题。

    我解决after my discussion in the comments here 的步骤是:

    1. 卸载所有 App Insights NuGet 包
    2. 删除 ApplicationInsights.config
    3. 安装 ApplicationInsights.Web
    4. 安装 ApplicationInsights.TraceListener
    5. 将 App Insights 实例的 InstrumentationKey 添加到 ApplicationInsights.config

    希望这会有所帮助。

    【讨论】:

    • 您也可以尝试以编程方式设置遥测密钥。我喜欢使用配置转换来为每个环境设置我的 Instrumentation 密钥。 TelemetryConfiguration.Active.InstrumentationKey = appInsightsKey;
    猜你喜欢
    • 1970-01-01
    • 2023-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-19
    • 1970-01-01
    • 2018-08-09
    • 2017-06-28
    相关资源
    最近更新 更多