-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to filter out extra log categories #2916
Comments
Those logs are from HttpClient, which are not owned by the functions team. You can control them via the category Also, please refer to https://opensource.microsoft.com/codeofconduct/ for future engagements. |
I ran into the same issue (and frustration), with other solutions such as setting the logLevel in host.json not working for me. I was finally able to suppress the unwanted HTTP Information logs, while showing my own custom Information logs, using this code snippet in my Program.cs. I don't know why I couldn't get the filter to work coming from host.json, but this worked for me.
|
@jviau I guess we're talking about the worker process because the URI is due to settlement from ServiceBus trigger. The summary is at the bottom. I attempted to put (as per various other issues)
into Current content of host.json is
without effect. My startup code is as follows
appsettings.json contains
I even added additional categories because a sample event in Seq looks as follows In one of the issues, someone suggested that the category might be wrong and I went to check the complete log event in Azure portal, under "Logs" (I find them in "Dependencies" table), but the category is nowhere to be found?? So, in summary:
Which gives? Are filter rules evaluated before being given to the logging provider (in this case, Serilog with Seq sink, among others) or by the logging provider (i.e., I'm looking at the wrong place and I should be configuring Serilog provider instead)? |
I think I have found the culprit. Not yet tested, but I'm pretty sure that's the cause. As per https://learn.microsoft.com/en-us/dotnet/core/extensions/logging?tabs=command-line#how-filtering-rules-are-applied , rules for the specific provider take priority over everything else. Serilog's extension method on
So no matter what I do with the defaults, the above rule will trump them. EDIT: Finally resolved:
|
I believe it is actually an issue with your trailing comma. We will be relaxing the parsing of host.json in the worker to avoid this in the future. |
The above was just an excerpt; there are no issues in the complete host.json file (Visual Studio doesn't complain -- no green squiggles). Sorry for the confusion. |
Situation: Azure Function, ServiceBus trigger, "standard" AF setup for NET8 isolated. We have a Serilog logging back-end that sends data to Seq.
No matter what I do from the solutions mentioned in the issues below, the logs keep appearing. I've spent a whole workday on this, and nothing seems to work. Is there a reliable step-by-step recipe, either through configuration or code, to get rid of these logs, without setting the global level to "Warning"?
Related links #1025 #2531 #1182 Azure/azure-functions-host#9259 Azure/azure-functions-core-tools#3059
The text was updated successfully, but these errors were encountered: