I have been trying to filter out information messages that my ServiceBus triggered webjob is sending in the Application Insights. These messages consist of these two logs:
ReceiveBatchAsync start. MessageCount = 1
ReceiveBatchAsync done. Received '0' messages. LockTokens =
My goal is to only log information traces that I am logging in my code and ignore the logs coming from Azure.Messaging.ServiceBus. How can I achieve this?
So far I have tried to add a filter using the following code in my program.cs file
b.AddFilter("Azure.Messaging.ServiceBus", LogLevel.Warning);
and I have also tried to add the following settings in my appsettings.json file
"Logging": {
"LogLevel": {
"Default": "Information",
"Azure.Messaging.ServiceBus": "Warning"
}
},
As for my set up I am using the following packages which are of concern:
- Microsoft.Extensions.Logging.Console
- Microsoft.Azure.WebJobs.Extensions.ServiceBus
The following code is my Logging configuration in the program.cs file.