简体   繁体   English

Azure Application Insights 跟踪未显示

[英]Azure Application Insights traces not showing

I am trying to configure Logging for my .NET 6 Blazor server application.我正在尝试为我的 .NET 6 Blazor 服务器应用程序配置日志记录。 In the past it has not been an issue for me, but now I can not see any Traces logs on Azure.过去这对我来说不是问题,但现在我在 Azure 上看不到任何 Traces 日志。 I have been followring these qusetions:我一直在关注这些问题:

Application Insights' Logs Not Writing to Traces Log Application Insights 的日志未写入跟踪日志

ILogger Logging Doesn't Show Up in Azure Application Insights ILogger 日志记录未显示在 Azure Application Insights 中

Moreover I have followed the documentation here:此外,我在这里遵循了文档:

Application Insights logging with .NET 使用 .NET 进行 Application Insights 日志记录

Application Insights for ASP.NET Core applications ASP.NET 核心应用的应用洞察

Migrate from Application Insights instrumentation keys to connection strings 从 Application Insights 检测密钥迁移到连接字符串

Sampling in Application Insights Application Insights 中的采样

The code编码

AppSettings应用设置

"Logging": {
    "LogLevel": {
      "Default": "Warning"
    },
    "ApplicationInsights": {
      "LogLevel": {
        "Default": "Warning"
      }
    }
  },

"ApplicationInsights": {
    "ConnectionString": "
InstrumentationKey=Here i put the InstrumentationKey ofc. ;IngestionEndpoint=https://northeurope2.in.applicationinsights.azure.com/
;LiveEndpoint=https://northeurope.livediagnostics.monitor.azure.com/"
  },

Program.cs程序.cs

var options = new ApplicationInsightsServiceOptions { ConnectionString = configuration["ApplicationInsights:ConnectionString"] };
builder.Services.AddApplicationInsightsTelemetry(options);

The razor.cs page razor.cs 页面

    [Inject]
    public ILogger<NailOtherSingelShearTimberTimber> Logger { get; set; }

    public async Task SaveFile()
    {
        Logger.LogWarning("File saved");       
    }

If i run it locally I can see it is being sent...如果我在本地运行它,我可以看到它正在发送......

在此处输入图像描述

But I get nothing on Azure no matter how long i wait.但无论我等多久,我在 Azure 上一无所获。

在此处输入图像描述

And Data sampling is set to 100%并且数据采样设置为100%

在此处输入图像描述

Does anyone know what I am doing wrong?有谁知道我做错了什么?

After two days without any success I decided to delete the web app + resource group and created a new web app.两天没有成功后,我决定删除 web 应用程序 + 资源组并创建一个新的 web 应用程序。 Then I updated the connection string in AppSettings, published the application and now logging works like a charm.然后我更新了 AppSettings 中的连接字符串,发布了应用程序,现在日志记录就像一个魅力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM