Open Yashuaa opened 2 years ago
bump
hello?
is anyone out there? echoes
Imagine - a whole week - and not even a comment lol.
hey, its me again
Hi @Yashuaa 👋
Where are you seeing this log messages? How does your Logging
or LogLevel
settings configured? You should be able to update the log level for any logger category using these settings.
Hi @kshyju . This is in Azure Functions Log Stream... I can't find out how to suppress... I've looked everywhere, I don't think it's possible to suppress just the request garbage and not EVERYTHING under the information category .... does that make sense ?
@Yashuaa Can your host.JSON, specifically the logging portion of the JSON. Also, Is this is a V3 app or V4? In-proc or isolated?
FYI here's a pretty good writeup of how to suppress various logs: https://github.com/anthonychu/functions-log-suppression
In addition to @kshyju's questions - I'm also curious what language this is for? (.NET/JavaScript/etc.)
this is .NET 6 C# Azure Function v4 (the latest)
@Yashuaa Can your host.JSON, specifically the logging portion of the JSON?
sure..
"logging": {
"logLevel": {
"Function": "Information",
"default": "None"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
},
"httpAutoCollectionOptions": {
"enableHttpTriggerExtendedInfoCollection": false,
"enableW3CDistributedTracing": false,
"enableResponseHeaderInjection": false
}
}
}
Any ideas anyone? @kshyju
I guess there is no way to do this unless you change the log level above Information, but then you suppress all of your logs.
I'm having the same issue where I am also seeing a Verbose Log message with Request headers exposing the Authorization header. Any ideas on how to suppress these log messages:
2023-01-18T20:08:09Z [Information] Start processing HTTP request GET <url>
2023-01-18T20:08:09Z [Verbose] Request Headers:
Authorization: ...
Same issue. The Request headers do not show up in App insights but do show up in log stream. My host.json contains the following and it didn't help. Any other suggestions?
"logLevel": {
"default": "Error",
"Azure.Core": "Warning",
"System.Net.Http.HttpClient": "Warning"
}
I have the same issue in my Azure Function (.net7 dotnet-isolated ) with http Client injected. ` public class Function1 { private readonly ILogger _logger; private readonly HttpClient _httpClient;
public HwBLDImport(ILogger<Function1> logger, IHttpClientFactory httpClientFactory)
{
_logger = logger;
_httpClient = httpClientFactory.CreateClient();
_httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
}
// rest of the code `
and a very simple start up ` using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting;
var host = new HostBuilder() .ConfigureFunctionsWorkerDefaults() .ConfigureServices((config, services) => { services.AddHttpClient(); }) .Build();
host.Run(); `
host.json simply ignores what every I add to stop the http client logging `
{ "version": "2.0", "logging": { "logLevel": { "System.Net.Http.HttpClient.*": "Error" }, "applicationInsights": { "samplingSettings": { "isEnabled": true, "excludedTypes": "Request" } } } } `
The log suppressions that Anthony Chu mentioned do not work https://github.com/anthonychu/functions-log-suppression
I know it was resolved issue with hosts.json for out-of-process Azure Functions but it seems not to work for .net 5,6,7 Isolated mode... Any ideas how to resolve it for Isolated?
This was annoying for me too. As a workaround I added this to Program.cs:
.ConfigureLogging(logging =>
{
logging.AddFilter("Azure.Core", LogLevel.Warning);
})
This was annoying for me too. As a workaround I added this to Program.cs:
.ConfigureLogging(logging => { logging.AddFilter("Azure.Core", LogLevel.Warning); })
for which object you added this?
i added
.ConfigureLogging(logging => { logging.SetMinimumLevel( LogLevel.Warning); })
and log my information with _logger.LogWarning.
Is there a way to keep the logInformation added in the code without using _logger.LogWarning?
For anyone experiencing this in .NET 8 Isolated: I found that the host.json file needed to be specifically loaded as a configuration file in order for the application to load it. Perhaps this is part of the standard template, but it's easy to miss when migrating.
hostBuilder.ConfigureAppConfiguration((context, builder) =>{ builder.AddJsonFile("host.json", optional: true); ....
As also noted in other articles, there's a default rule that prevents logging above warning level to app insights. This is disabled using the following code:
.ConfigureLogging(logging =>
{
// The Application Insights SDK adds a default logging filter that instructs ILogger to capture only Warning and more severe logs. Application Insights requires an explicit override.
// Configuration in hosts did not override
logging.Services.Configure<LoggerFilterOptions>(options =>
{
LoggerFilterRule? defaultRule = options?.Rules?.FirstOrDefault(rule => rule.ProviderName == "Microsoft.Extensions.Logging.ApplicationInsights.ApplicationInsightsLoggerProvider");
if (defaultRule is not null)
{
options!.Rules.Remove(defaultRule);
}
});
})
The below is a sample content for host.json - note the "System.Net.Http.HttpClient": "None". Dependencies for HTTP calls are still tracked, so we really don't need the noise the httpclient throws out. Once the host.json was specifically loaded to config, it was then seemingly respected.
"logging": {
"logLevel": {
"default": "Information",
"Function": "Information",
"Host.Aggregator": "Information",
"Azure.Messaging.ServiceBus": "Warning",
"Azure.Core": "Warning",
"Azure.Core.1": "Warning",
"Azure.Core.2": "Warning",
"Azure.Core.3": "Warning",
"Azure.Core.4": "Warning",
"Azure.Storage.Blobs": "Warning",
"Azure.Storage.Tables": "Warning",
"DurableTask.AzureStorage": "Warning",
"System.Net.Http.HttpClient": "None"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Traces;Exceptions"
},
"enableLiveMetricsFilters": true
}
},
Hi,
We make multiple http request, I don't want to see this puke
Sending HTTP request GET https://www.some-external-api.com....
How can I disable these logs?
I tried
"logging:logLevel:Microsoft.Azure.WebJobs.Script.WebHost.Middleware.SystemTraceMiddleware": "None"
and it didn't work..For example I don't want to see these HTTP logs that are similar to this