Repository navigation
fix(logging): stop configuring the root logger on import - #4748
Merged
Merged
Conversation
Contributor
Importing nemo_gym called logging.debug() on the root logger. With no handlers configured yet, that call runs logging.basicConfig() implicitly and attaches a stderr handler at WARNING level. Any later logging.basicConfig() in the importing application then does nothing, so its INFO logs are silently dropped. Log through module loggers instead, in nemo_gym/__init__.py and in the openai version skew warning in global_config.py. Signed-off-by: Ingo Guehring <[email protected]>
iguehring-nvidia
force-pushed
the
iguehring/no-root-logging-on-import
branch
from
October 19, 2026 16:32
e32d523 to
f421a87
Compare
Contributor
Author
|
/review |
svcnvidia-nemo-ci
left a comment
Contributor
There was a problem hiding this comment.
SHIP
LGTM — no reliability concerns. The import-time debug message and OpenAI version-skew warning now use module loggers without implicitly configuring root handlers. Dependency-resolution behavior is unchanged, and CLI verbose logging remains explicitly configured.
Reviewed both changed files and the directly affected callers and existing tests. Static review only; tests were not executed.
Note: formal approval is not available for this request, so this review is posted as a comment only.
Review generated by codex
iguehring-nvidia
enabled auto-merge
October 19, 2026 17:17
cmunley1
approved these changes
Oct 19, 2026
cmunley1
disabled auto-merge
October 19, 2026 19:09
iguehring-nvidia
added a commit
that referenced
this pull request
Oct 19, 2026
Signed-off-by: Ingo Guehring <[email protected]>
7 tasks done
This branch was previously 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.
What does this PR do?
Stops
import nemo_gymfrom configuring the root logger, so applications that import Gym keep control of their own logging.nemo_gym/__init__.pycallslogging.debug(...)at import time (_augment_sys_path). The module-levellogging.debug/logging.warninghelpers log to the root logger, and when the root logger has no handlers yet they calllogging.basicConfig()first. Importingnemo_gymtherefore attaches a stderr handler to the root logger, which stays at its defaultWARNINGlevel. Sincelogging.basicConfig()does nothing once the root logger has a handler, an application that importsnemo_gymand then callslogging.basicConfig(level=logging.INFO, ...)silently keepsWARNING: all of its ownINFOlogs are dropped, with no error.This PR logs through module loggers instead:
nemo_gym/__init__.py: thesys.pathdebug message.nemo_gym/global_config.py: the openai version skew warning, which used the root logger although the module already haslogger.Gym's own output does not change: the debug message stays hidden by default, and the warning still reaches stderr through
logging.lastResortwhen nothing is configured.Validation
maintheINFOline is dropped; with this change it printsINFO:app:started.pytest tests/unit_tests(8,581 passed): the same 36 tests fail with and without this change, all in areas unrelated to logging (sandbox provider, launcher and optional-dependency tests that fail in my local environment).nemo_gym, plans a benchmark and runs a task in-process, then configures logging atINFO: itsINFOlogs now appear; the task result is unchanged.gym eval prepareandgym eval run --benchmark ifeval --model-type openai_model --split benchmark --limit 2against an OpenAI-compatible endpoint. Both exit 0 with 2 rollouts, and the console output has the same 323 lines; the only differences are process ids, timings, the order of interleaved server lines, and the sampled model answers.pre-commit runon the changed files: passed.