fix(agent): apply the configured logger_level to the default logger - #376
Conversation
The default logger's level was never set, so MonoLogger (a Logger subclass, DEBUG threshold by default) let every message through regardless of config.logger_level. get_level() is also normalized to be case-insensitive, since config.logger_level defaults to the lowercase 'info' while the LEVELS lookup table is capitalized. Fixes #371
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (1)
🛟 Help
|
|
Fix confirmed on my side: I ran the suite on the branch (1101 examples, 0 failures) and replayed the new specs against the unpatched One thing worth adding to the PR body / release note before merging: this changes the log verbosity for every user who never touched the setting. Both That's exactly the intended fix, but it goes out as
|
christophebrun-forest
left a comment
There was a problem hiding this comment.
Just 2 suggestions
There was a problem hiding this comment.
Need to add the 2 missing statuses : FATAL and UNKNOW ; see the reason below.
| @logger_level = logger_level | ||
| @logger = logger | ||
| @default_logger = MonoLogger.new($stdout) | ||
| @default_logger.level = get_level(@logger_level) || Logger::INFO |
There was a problem hiding this comment.
If it's FATAL, we translate it to INFO; so, instead of aiming for less verbosity, we end up with maximum verbosity.
Without these, configuring logger_level: 'Fatal' (the quietest setting) hit the LEVELS lookup miss and fell back to Info -- the opposite of what was requested. Both now map to their Logger constants. Found by @christophebrun-forest in review on #376.
## [1.39.3](v1.39.2...v1.39.3) (2026-08-26) ### Bug Fixes * **agent:** apply the configured logger_level to the default logger ([#376](#376)) ([bb4ac89](bb4ac89)), closes [#371](#371) * **customizer:** mark a field sortable only when the sort decorator can order it (PRD-1036) ([#368](#368)) ([a04900d](a04900d))
|
🎉 This PR is included in version 1.39.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |

What
The default logger's level was never applied:
logger_service.rbstored@logger_levelbut builtMonoLogger.new($stdout)without ever calling.level =on it. SinceMonoLoggerinherits fromLogger(DEBUG threshold by default), every message got through regardless ofconfig.logger_level— the setting only worked when a customloggerproc was supplied.Also normalized
get_levelto be case-insensitive:forest_admin_rails/forest_admin_rpc_agentdefaultlogger_levelto the lowercase'info', while theLEVELSlookup table keys are capitalized ('Info','Warn', ...). Without this, the fix above would silently no-op for the (lowercase) default and for anyone typing e.g.'warn'instead of'Warn'.Why
Fixes #371.
How tested
packages/forest_admin_agent/spec/lib/forest_admin_agent/services/logger_service_spec.rbforest_admin_agentsuite green locally (1162 examples, 0 failures)rubocopclean on the changed files🤖 Generated with Claude Code
Note
Apply configured
logger_levelto default logger inLoggerServiceThe default logger was not using the configured severity threshold at construction time.
LoggerService#initializenow callsget_level(@logger_level)to set the default logger's level, andget_levelnormalizes input withto_s.capitalizebefore indexing intoLEVELS, so case-insensitive names and symbols are accepted. Unknown levels fall back toLogger::INFO.get_levelnow treats:debugand'debug'as valid inputs where it previously did not; callers relying on strict case-sensitive matching may see different levels applied.Changes since #376 opened
FatalandUnknownlogger severity levels toForestAdminAgent::Services::LoggerService[54518d0]Macroscope summarized b2f7091.