-
Notifications
You must be signed in to change notification settings - Fork 330
Fix CLI overrides LogLevel value from config file #3426
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
base: main
Are you sure you want to change the base?
Changes from all commits
514a4d7
e8b0767
0b9a0b9
9328c2d
d74ad94
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2597,18 +2597,27 @@ public static bool TryStartEngineWithOptions(StartOptions options, FileSystemRun | |
|
|
||
| minimumLogLevel = (LogLevel)options.LogLevel; | ||
| _logger.LogInformation("Setting minimum LogLevel: {minimumLogLevel}.", minimumLogLevel); | ||
| args.Add("--LogLevel"); | ||
| args.Add(minimumLogLevel.ToString()); | ||
| } | ||
| else | ||
| { | ||
| minimumLogLevel = deserializedRuntimeConfig.GetConfiguredLogLevel(); | ||
| HostMode hostModeType = deserializedRuntimeConfig.IsDevelopmentMode() ? HostMode.Development : HostMode.Production; | ||
| bool isValueFromDefault = !deserializedRuntimeConfig.IsLogLevelNull() && deserializedRuntimeConfig.Runtime!.Telemetry!.LoggerLevel! | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how is the function GetConfiguredLogLevel getting the minimumLogLevel? isnt it from the config file? if it is obtained in a similar manner, |
||
| .SingleOrDefault(kvp => kvp.Key.Equals("default", StringComparison.OrdinalIgnoreCase)).Value != null; | ||
RubenCerna2079 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| _logger.LogInformation($"Setting default minimum LogLevel: {minimumLogLevel} for {hostModeType} mode.", minimumLogLevel, hostModeType); | ||
| // Check if we set the minimum LogLevel from the config file or if it is based on the host mode. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we are not using the |
||
| if (isValueFromDefault) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the use of figuring out |
||
| { | ||
| _logger.LogInformation("Using default minimum LogLevel: {minimumLogLevel} from the 'Default' namespace in config file.", minimumLogLevel); | ||
| } | ||
| else | ||
| { | ||
| _logger.LogInformation("Setting default minimum LogLevel: {minimumLogLevel} for {hostModeType} mode.", minimumLogLevel, hostModeType); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are we doing in the else part to set the minimum log level? We do a log message here but what is setting the loglevel in the LogLevel provider? |
||
| } | ||
| } | ||
|
|
||
| args.Add("--LogLevel"); | ||
| args.Add(minimumLogLevel.ToString()); | ||
|
|
||
| // This will add args to disable automatic redirects to https if specified by user | ||
| if (options.IsHttpsRedirectionDisabled) | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested whether different namespaces within DAB honor the different log levels? when the loglevel from CLI is not overriding the level?
This config is only testing the default namespace scenario,