Fix log level: CLI phase suppression, case-insensitive "default" key, dynamic runtime log level#3235
Draft
Fix log level: CLI phase suppression, case-insensitive "default" key, dynamic runtime log level#3235
Conversation
…case-insensitive default key, CLI log level pre-parsing Co-authored-by: souvikghosh04 <210500244+souvikghosh04@users.noreply.github.com>
…log, use FirstOrDefault for default key Co-authored-by: souvikghosh04 <210500244+souvikghosh04@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor code and ensure test case coverage
Fix log level: CLI phase suppression, case-insensitive "default" key, dynamic runtime log level
Mar 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why make this change?
Implements and refines the log level improvements from PR #3203, addressing all open review comments:
dab start --LogLevel Warningstill emitted CLI-phaseInformationmessages becauseCustomConsoleLoggerhad a hardcodedLogLevel.Informationminimum and the logger factory was created before CLI args were parsed."Default"(capital D) was silently ignored —TryGetValue("default")is case-sensitive.IsLoggerFilterValidwas case-sensitive, rejecting valid mixed-case namespace filters.What is this change?
New:
DynamicLogLevelProvider(src/Service/Telemetry/)RuntimeConfigunless the CLI already overrode it.Program.GetLoggerFactoryForLogLevelandConfigureLoggingdelegate toLogLevelProvider.ShouldLog()instead of capturing a static level at startup.New:
StartupLogBuffer(src/Config/)ILogger.FileSystemRuntimeConfigLoaderwrites to the buffer during early startup;Startup.ConfigurecallsFlushLogBuffer()once the proper logger is resolved.CLI phase respects
--LogLevelCli/Program.Maincalls newPreParseLogLevel(args)beforeCommandLine.Parserruns, wiring the result intoCustomLoggerProvider(minimumLogLevel).CustomConsoleLogger._minimumLogLevelis now constructor-injected instead of hardcoded toInformation.Bug fixes
RuntimeConfig.GetConfiguredLogLevel:StartsWith→OrdinalIgnoreCase;"default"key lookup usesFirstOrDefaultwithOrdinalIgnoreCase(wasTryGetValue("default"), exact match only).RuntimeConfigValidator.IsLoggerFilterValid: segment comparison usesOrdinalIgnoreCase.FileSystemRuntimeConfigLoader: allConsole.WriteLinecalls replaced with privateLogInformation/LogWarning/LogErrorhelpers that route_logger → buffer → Console; eliminated duplicate log entry in hot-reload path.Program.StartEngine: removedConsole.WriteLine("Starting the runtime engine...")(suppressed at Warning+ but was checked by tests regardless).Test refactoring
TestEngineStartUpWithVerboseAndLogLevelOptionssplit into two[DataTestMethod]groups:process.WaitForExit(1000)+Assert.IsFalse(exitedWithinTimeout)— fixes the race condition fromAssert.IsFalse(process.HasExited).ValidStringLogLevelFiltersgains a"Default"(capital D) data row.How was this tested?
StartupLogBufferTests(4): replay order, null-logger discard, idempotent flush, empty bufferDynamicLogLevelProviderTests(6):SetInitialLogLevel,UpdateFromRuntimeConfigwith/without CLI override,ShouldLogboundary casesGetConfiguredLogLevelTests(3):"default"/"Default"/"DEFAULT"variants, specific-filter-over-default priorityProgramPreParseLogLevelTests(22): all numeric and named log levels including mixed-case, edge cases (absent flag, invalid value, out-of-range, flag-with-no-value)Sample Request(s)
Original prompt
Created from VS Code.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.