【发布时间】:2022-12-02 07:21:18
【问题描述】:
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.
【问题讨论】:
-
I have the exact same problem. Were you ever able to solve it?
-
I was not able to solve it so far. I believe there is a workaround by implementing Serilog (I have not tested if Serilog works), but I wish to solve it without including other third-party packages.
标签: azure azure-application-insights azureservicebus azure-webjobs log-level