[英]Azure Application Insights traces not showing
我正在嘗試為我的 .NET 6 Blazor 服務器應用程序配置日志記錄。 過去這對我來說不是問題,但現在我在 Azure 上看不到任何 Traces 日志。 我一直在關注這些問題:
Application Insights 的日志未寫入跟蹤日志
ILogger 日志記錄未顯示在 Azure Application Insights 中
此外,我在這里遵循了文檔:
使用 .NET 進行 Application Insights 日志記錄
從 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/"
},
程序.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");
}
如果我在本地運行它,我可以看到它正在發送......
但無論我等多久,我在 Azure 上一無所獲。
並且數據采樣設置為100%
有誰知道我做錯了什么?
兩天沒有成功后,我決定刪除 web 應用程序 + 資源組並創建一個新的 web 應用程序。 然后我更新了 AppSettings 中的連接字符串,發布了應用程序,現在日志記錄就像一個魅力。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.