I'm using a Microsoft.Extensions.Hosting.BackgroundService. In the ExecuteAsync method I start the telemetry operation:
using (_telemetryClient.StartOperation<RequestTelemetry>("someOperationName"))
{ [service implementation goes here] }
In the service implementation I use _logger.LogInformation. And I also call other methods of different classes in my service implementation which also log informations.
These entries are not shown in Azure.
Is there a way to automatically show the log entries of all called methods in Azure Application Insights (Performance -> Operations tab)?
Appsettings:
"Logging": {
"ApplicationInsights": {
"LogLevel": {
"Default": "Information"
}
},
"LogLevel": {
"Default": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
"AllowedHosts": "*"
},
ConfigureServices:
services.AddHostedService<Worker>();
services.AddApplicationInsightsTelemetryWorkerService();
The instrumentation key is set in Azure. I followed these instructions: https://docs.microsoft.com/en-us/azure/azure-monitor/app/worker-service#net-core-30-worker-service-application
StartOperation
for example, like you do already. – Peter BonsLogInformation
? – Peter Bons