Skip to content

fix(logger): do not output WARN level logs for non-root modules#3760

Merged
aignas merged 6 commits intobazel-contrib:mainfrom
aignas:aignas.fix.only-warn-root-module
May 10, 2026
Merged

fix(logger): do not output WARN level logs for non-root modules#3760
aignas merged 6 commits intobazel-contrib:mainfrom
aignas:aignas.fix.only-warn-root-module

Conversation

@aignas
Copy link
Copy Markdown
Collaborator

@aignas aignas commented May 8, 2026

A user has reported issues which actually resulted from a particular
bazel version being used and once he updated, the issues disappeared
because of changes in implicit non-root module dependencies.

In order to reduce the warning spam of non-root modules, set the default
level to ERROR for non-root module parsing context and WARN for root
module context. This means that the users will not get console output
that they have no way to fix without patching upstream dependencies.

At the same time ensure that the name of the module is printed together
with the logs to better understand where something is coming from.

Fixes #3749

A user has reported issues which actually resulted from a particular
`bazel` version being used and once he updated, the issues disappeared
because of changes in implicit non-root module dependencies.

In order to reduce the warning spam of non-root modules, set the default
level to `ERROR` for non-root module parsing context and `WARN` for root
module context. This means that the users will not get console output
that they have no way to fix without patching upstream dependencies.

At the same time ensure that the name of the module is printed together
with the logs to better understand where something is coming from.

Fixes bazel-contrib#3749
@aignas aignas requested a review from rickeylev as a code owner May 8, 2026 05:26
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request reduces the default log verbosity for non-root modules in Bzlmod by passing the module context to the logger. Review feedback identifies that the verbosity mapping in repo_utils.bzl must be updated to include ERROR and WARN levels to effectively silence warnings for non-root modules. Additionally, it is recommended to pass the module context to the global logger in python.bzl to ensure consistent behavior across the extension.

Comment thread python/private/repo_utils.bzl
Comment thread python/private/python.bzl Outdated
@rickeylev rickeylev added this pull request to the merge queue May 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 8, 2026
@rickeylev rickeylev added this pull request to the merge queue May 8, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 8, 2026
@aignas aignas mentioned this pull request May 8, 2026
aignas and others added 4 commits May 9, 2026 07:33
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@aignas aignas enabled auto-merge May 10, 2026 06:15
Comment thread python/private/repo_utils.bzl
@aignas aignas added this pull request to the merge queue May 10, 2026
Merged via the queue into bazel-contrib:main with commit 5511aaf May 10, 2026
4 checks passed
@aignas aignas deleted the aignas.fix.only-warn-root-module branch May 10, 2026 07:00
aignas added a commit that referenced this pull request May 10, 2026
A user has reported issues which actually resulted from a particular
`bazel` version being used and once he updated, the issues disappeared
because of changes in implicit non-root module dependencies.

In order to reduce the warning spam of non-root modules, set the default
level to `ERROR` for non-root module parsing context and `WARN` for root
module context. This means that the users will not get console output
that they have no way to fix without patching upstream dependencies.

At the same time ensure that the name of the module is printed together
with the logs to better understand where something is coming from.

Fixes #3749

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
(cherry picked from commit 5511aaf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance degradation and warning messages after upgrading to rules_python 2.0.0 (was fine in 1.9.0)

2 participants