Microsoft.ApplicationInsights.AspNetCore v2.6.1与 .net core v2.2.2 一起使用时,我可以看到 Azure Application Insight Live Metric Stream 中的遥测数据,但我没有看到我尝试在控制器ILogger内部Startup.cs或控制器中记录的条目。
我试过.UseApplicationInsights()用WebHost.CreateDefaultBuilder在Program.cs和也Startup.cs像这样,但无济于事。
services.AddApplicationInsightsTelemetry( options => {
options.EnableDebugLogger = true;
});
Run Code Online (Sandbox Code Playgroud)
我看到传入的请求和请求失败率,但没有日志条目
this.logger.Log(LogLevel.Error, $"Test Error {Guid.NewGuid().ToString()}");
this.logger.LogTrace($"Test Trace {Guid.NewGuid().ToString()}");
this.logger.LogInformation($"Test Information {Guid.NewGuid().ToString()}");
this.logger.LogWarning($"Test Warning {Guid.NewGuid().ToString()}");
this.logger.LogCritical($"Test Critical {Guid.NewGuid().ToString()}");
this.logger.LogError($"Test Error{Guid.NewGuid().ToString()}");
this.logger.LogDebug($"Test Debug {Guid.NewGuid().ToString()}");
Run Code Online (Sandbox Code Playgroud)