gpt4 book ai didi

c# - Azure Application Insights 跟踪未显示

转载 作者:行者123 更新时间:2023-12-02 23:55:04 25 4
gpt4 key购买 nike

我正在尝试为我的 .NET 6 Blazor 服务器应用程序配置日志记录。过去这对我来说不是问题,但现在我在 Azure 上看不到任何跟踪日志。我一直在关注这些问题:

Application Insights' Logs Not Writing to Traces Log

ILogger Logging Doesn't Show Up in Azure Application Insights

此外,我还遵循了此处的文档:

Application Insights logging with .NET

Application Insights for ASP.NET Core applications

Migrate from Application Insights instrumentation keys to connection strings

Sampling in Application Insights

代码

应用程序设置

"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

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

razor.cs 页面

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

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

如果我在本地运行它,我可以看到它正在发送...

enter image description here

但无论我等多久,我都无法在 Azure 上得到任何结果。

enter image description here

数据采样设置为 100%

enter image description here

有人知道我做错了什么吗?

最佳答案

两天后没有任何成功,我决定删除网络应用程序+资源组并创建一个新的网络应用程序。然后我更新了 AppSettings 中的连接字符串,发布了应用程序,现在日志记录就像一个魅力。

关于c# - Azure Application Insights 跟踪未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73579239/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com