Allow for the UserLogDefaultLogLevel
to be set independent of system logs
#4295
Labels
UserLogDefaultLogLevel
to be set independent of system logs
#4295
Description
In Core Tools today, the log level for user logs can only be set as the same value of system logs via the "default" property in host.json:
azure-functions-core-tools/src/Azure.Functions.Cli/Diagnostics/LoggingFilterHelper.cs
Lines 34 to 38 in bb4c949
azure-functions-core-tools/src/Azure.Functions.Cli/Common/Utilities.cs
Line 237 in bb4c949
And this is the only way to control the logs that user's can see when they run their application.
This is frustrating as you won't be able to see your debug logs without also seeing all of the debug logs coming from the system, and there is no way to filter those out.
Proposal
We can fix this either by
a) exposing a way for customers to set
UserLogDefaultLogLevel
without having to set the default log level, and/or without having to also set theSystemLogDefaultLogLevel
to the same value. This could be through something like a flag i.e.--userLogLevel Debug
, or environment setting. I would advise against this being a host.json setting.b) implement a way for us to respect the settings coming from workers. For example, in dotnet-isolated, you can set the min log level in your Program.cs:
builder.Logging.SetMinimumLevel(LogLevel.Debug);
Is there a way we can respect this setting without having to make customers manually configure
UserLogDefaultLogLevel
as well?I did also find that instead of setting the log level in Program.cs - you can also use appsettings.json; Core Tools(?) is respecting any appsettings.json file that is provided without any additional config, however
logLevel
in host.json is still required.Considerations
We often tell customers, and document, that host.json is only used to control host logs, and not worker logs. So it is confusing that you have to set the host log level to control your worker logs. I think we need a mechanism outside of host.json to control this.
My understanding is that this is an issue that only impacts local development so there shouldn't be need for changes in the workers
How do other workers outside of dni allow customers to configure their logging setttings? Does that need to be taken into account?
The text was updated successfully, but these errors were encountered: