Repository navigation
fix(core): restore logger after silent lazy module load - #17631
Merged
kamilmysliwiec merged 1 commit intoAug 30, 2026
Merged
Conversation
LazyModuleLoader.load() with { logger: false } replaced the shared
InstanceLoader logger with a SilentLogger but never restored it,
permanently silencing logs for all subsequent load() calls.
Fixes nestjs#17628
4 of 12 tasks
4 of 12 tasks
4 of 12 tasks
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.
Fixes #17628
What was wrong
Calling
lazyModuleLoader.load(ModuleA, { logger: false })replaced the sharedInstanceLoader's logger with aSilentLogger, but this was never reverted. As a result, passing{ logger: false }once permanently silencedInstanceLoaderlogging for every subsequent lazy module load in the application's lifetime.Why it happened
registerLoggerConfigurationonly ever set the logger toSilentLoggerwhenlogger === false— it never captured the original logger or restored it afterward:Since
instanceLoaderis a shared, application-scoped singleton, this mutation persisted across all futureload()calls, regardless of their ownloggeroption.What was changed
load()now captures theInstanceLoader's logger before silencing it, and restores it in afinallyblock once the currentload()call completes — ensuring the silencing is scoped to that single invocation, even if an error is thrown during loading.How it was tested
lazy-module-loader.spec.tsverifying that aload()call with{ logger: false }does not emit logs, and a subsequentload()call without it does.Why the change is safe
The change only affects the logger reference held by
InstanceLoaderduring and immediately after aload()call with{ logger: false }. Calls without that option are unaffected, since no silencing (and therefore no restoration) occurs for them.