Application Insights 具有指标和依赖项但没有信息跟踪
Application Insights has metrics and dependencies but no Information Traces
我有一个 ASP net 5。我看不到我的自定义跟踪,但我可以看到指标和依赖项
我认为这是 LogLevel 的问题,但似乎我无法找到正确的设置:
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddApplicationInsightsTelemetry(Configuration["ApplicationInsights:ConnectionString"]);
}
appsettings.json
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"ApplicationInsights": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information"
},
"ConnectionString": "InstrumentationKey=*****;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/"
},
代码:
public async Task SendMessageAsync()
{
...
using (this._logger.BeginScope(nameof(SendMessageAsync)))
{
...
_logger.LogInformation($"Message sent...");
...
}
}
在 VS 输出中,我看到正在记录信息消息,但没有看到 LogInformation 的 AppInsights 遥测
SenderApp.Controllers.HomeController: Information: Message sent...
Application Insights Telemetry: {"name":"AppDependencies","time":...
Application Insights Telemetry: {"name":"AppDependencies","time":...
答案很简单,但不容易调试。
appsettings.josn
中 AppInsights 的日志记录设置应该在 Logging
下
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Information"
},
"ApplicationInsights": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information"
}
}
},
"ApplicationInsights": {
"ConnectionString": "InstrumentationKey=*****;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/"
}
我有一个 ASP net 5。我看不到我的自定义跟踪,但我可以看到指标和依赖项 我认为这是 LogLevel 的问题,但似乎我无法找到正确的设置:
Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddApplicationInsightsTelemetry(Configuration["ApplicationInsights:ConnectionString"]);
}
appsettings.json
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"ApplicationInsights": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information"
},
"ConnectionString": "InstrumentationKey=*****;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/"
},
代码:
public async Task SendMessageAsync()
{
...
using (this._logger.BeginScope(nameof(SendMessageAsync)))
{
...
_logger.LogInformation($"Message sent...");
...
}
}
在 VS 输出中,我看到正在记录信息消息,但没有看到 LogInformation 的 AppInsights 遥测
SenderApp.Controllers.HomeController: Information: Message sent...
Application Insights Telemetry: {"name":"AppDependencies","time":...
Application Insights Telemetry: {"name":"AppDependencies","time":...
答案很简单,但不容易调试。
appsettings.josn
中 AppInsights 的日志记录设置应该在 Logging
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information",
"Microsoft.Hosting.Lifetime": "Information"
},
"ApplicationInsights": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Information"
}
}
},
"ApplicationInsights": {
"ConnectionString": "InstrumentationKey=*****;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/"
}