Repository navigation
Add a log level setting for the log file and console - #1796
Open
deepratna-awale wants to merge 2 commits into
Open
deepratna-awale wants to merge 2 commits into
deepratna-awale wants to merge 2 commits into
Conversation
The file log was fixed at Debug and the console at Trace, with no way for users to reduce how much gets written (LykosAI#1790). Add a Log Level option under Settings > System Settings. It sets the minimum level of the catch-all file and console rules, is applied when settings load and whenever it changes, and leaves the per-logger filters (System.*, Microsoft.*, etc.) untouched. The default stays at Debug so existing behaviour is unchanged.
Use Info as the default for new and existing settings files, and start the file and console rules at the same level so messages logged before settings load match the default.
This branch has not been deployed
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.
Summary
Resolves #1790.
The log file was hardcoded to Debug and the console to Trace, so users couldn't reduce how much gets written.
appsettings.jsonand environment variables don't help either, becauseConfigureLogging()callsLoadConfiguration(...)right afterLoadConfigurationFromSection(Config)and replaces those rules.This adds a Log Level option (Trace / Debug / Info / Warn / Error) under Settings > System Settings. It defaults to Info.
Changes
AppLogLevelenum and aSettings.LogLevelproperty, defaulting toSettings.DefaultLogLevel(Info). Existing settings files without the key also get Info.AppLogLevelAppliersets the minimum level on the catch-all (*) rules that write to the log file and console, unwrapping the async wrappers. Rules for specific loggers (System.*,Microsoft.*,OpenIddict.*and the trace-suppressed types) and the debug log-window target are left alone.RegisterPropertyChangedHandler, so no restart is needed.Label_LogLevelandLabel_LogLevel_Descriptionstrings.Testing
AppLogLevelApplierTests: every level is applied to the file and console rules, other rules stay unchanged, and a null config is a no-op. These pass along with the existingLogFileTargetTests.settings.jsonset to each of Trace, Debug, Info and Warn, and with noLogLevelkey.app.logand the console contained only messages at or above the chosen level. With no key, the level was Info.Notes for reviewers
app.logis already archived on each launch, with the 9 most recent sessions kept.ComfyClient.HandleTextMessage, which logs every websocket message type it doesn't handle at Warn with the full JSON payload (execution_start,execution_cached,executed,progress_state,execution_success, and custom-node broadcasts). A fix for that is ready as a follow-up PR once this one lands.