Allow for the UserLogDefaultLogLevel to be set independent of system logs
Issue describing the changes in this PR
Added --flag userLogLevel to set UserLogDefaultLogLevel without having to set the default log level, and without having to also set the SystemLogDefaultLogLevel to the same value.
resolves #4295
Pull request checklist
- [x] My changes do not require documentation changes
- [ ] Otherwise: Documentation issue linked to PR
- [x] My changes do not need to be backported to a previous version
- [ ] Otherwise: Backport tracked by issue/PR #issue_or_pr
- [x] I have added all required tests (Unit tests, E2E tests)
@liliankasem could you review the changes when have a moment.
Thanks
Thanks, did you also investigate option (b) in my proposal? It would be good to see if that works?
Second, can you validate this works for all language workers?
I am still on the fence between a flag or env var for this
@liliankasem
If we set "AzureFunctionsJobHost__Logging__LogLevel__Function" to 'debug' in local.settings.json or also use as an environment variable: Its showing debug logs for dotnet worker (if we set minimum level in program.cs), dotnet, Node, Python without depending on host.json. For Python changes PFB screenshot: using "AzureFunctionsJobHost__Logging__LogLevel__Function": "Debug" in local.settings.json file
()
The changes were made to setup the value of UserLoglevel and systemLogLevel be different by using --userLoglevel flag to show logs based on loglevel is not working. it's still depending on host.json
can i set the value of 'AzureFunctionsJobHost__Logging__LogLevel__Function' as UserLogDefaultLogLevel instead of --userLogLevel flag?
@liliankasem added new changes and tests. could you provide review. Thanks
@liliankasem added new changes and tests. could you provide review. Thanks
Sorry I didn't mean for you to remove the implementation for the --userLogLevel flag, just that we should decide which approach.
@aishwaryabh @mattchenderson @soninaren - can you share thoughts on what you think here?
a) We can provide a flag for users to set on func start => --userLogLevel
b) We can provide an environment variable that can be set in local.settings.json or in local env => ``
c) We can use the existing host.json logging properties. We know that a Function log category exists already, we can utilize that here. This might be a little more complicated in code as we would want to do something like:
- if
defaultis set, andFunctionis not set == setdefaultvalue for both user and system - if
defailtis not set, andFunctionis set == set user log value toFunction - if
default is set, andFunctionis set == usedefaultfor system andFunction` for user logs
"logLevel": {
"default": "Warning",
"Host.Aggregator": "Trace",
"Host.Results": "Information",
"Function": "Information" // use this to set user log level
}
I am thinking we do both a and c - where users can utilize the host config file or they can set the flag with a func start command as a one off debug situation. Thoughts?
@VineethReyya lets hold off on more changes until we have consensus with the team, thanks!
@liliankasem added new changes and tests. could you provide review. Thanks
Sorry I didn't mean for you to remove the implementation for the --userLogLevel flag, just that we should decide which approach.
@aishwaryabh @mattchenderson @soninaren - can you share thoughts on what you think here?
a) We can provide a flag for users to set on func start =>
--userLogLevelb) We can provide an environment variable that can be set in local.settings.json or in local env => ``
c) We can use the existing host.json logging properties. We know that a
Functionlog category exists already, we can utilize that here. This might be a little more complicated in code as we would want to do something like:
- if
defaultis set, andFunctionis not set == setdefaultvalue for both user and system- if
defailtis not set, andFunctionis set == set user log value toFunction- if
default is set, andFunctionis set == usedefaultfor system andFunction` for user logs"logLevel": { "default": "Warning", "Host.Aggregator": "Trace", "Host.Results": "Information", "Function": "Information" // use this to set user log level }I am thinking we do both
aandc- where users can utilize the host config file or they can set the flag with a func start command as a one off debug situation. Thoughts?@VineethReyya lets hold off on more changes until we have consensus with the team, thanks!
@liliankasem Based on your inputs, I made changes work for both 'a' and 'c'. please review when you have a moment Thanks for the help.
@liliankasem @aishwaryabh Following up on my previous message—could you please take a moment to review the changes? I’d appreciate your feedback when convenient
@liliankasem @aishwaryabh Following up on my previous message—could you please take a moment to review the changes? I’d appreciate your feedback when convenient
Lets put this on pause for now whilst we dicuss internally how we want to do this.