using (_telemetryClient.StartOperation<RequestTelemetry>("someOperationName"))
{ [service implementation goes here] }
在我使用的服务实现中_logger.login信息.
我还在服务实现中调用不同类的其他方法,这些方法也记录信息。
这些条目不会在Azure中显示。
是否有一种方法可以自动显示Azure Application Insights(性能->操作选项卡)中所有调用方法的日志条目?
"Logging": {
"ApplicationInsights": {
"LogLevel": {
"Default": "Information"
}
},
"LogLevel": {
"Default": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
"AllowedHosts": "*"
},
services.AddHostedService<Worker>();
services.AddApplicationInsightsTelemetryWorkerService();
我遵循这些指示:
https://docs.microsoft.com/en-us/azure/azure-monitor/app/worker-service#net-core-30-worker-service-application