Skip to content

[v2-11-test] Fix root logger level cache invalidation in LoggerMutationHelper#61644

Open
seoin0110 wants to merge 1 commit intoapache:v2-11-testfrom
seoin0110:fix-root-logger-level-cache
Open

[v2-11-test] Fix root logger level cache invalidation in LoggerMutationHelper#61644
seoin0110 wants to merge 1 commit intoapache:v2-11-testfrom
seoin0110:fix-root-logger-level-cache

Conversation

@seoin0110
Copy link

@seoin0110 seoin0110 commented Feb 8, 2026

Why

Currently, the code assigns the log level directly to the .level attribute.
This violates the official Python documentation, which explicitly states:

  • Note: Do not set this attribute directly - always use setLevel(), which has checks for the level passed to it.

This direct assignment bypasses the Python logging module's _invalidate_cache() mechanism. If the root logger was previously initialized with a different level (e.g., WARNING), the stale cache persists. This causes logs (e.g., INFO) to be suppressed during task execution even after the level update.

What

Change the assignment to use the standard method .setLevel().
This ensures the internal cache is cleared via _invalidate_cache() and the new level takes effect immediately.

@boring-cyborg
Copy link

boring-cyborg bot commented Feb 8, 2026

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@eladkal eladkal requested a review from potiuk February 8, 2026 16:18
@jscheffl
Copy link
Contributor

jscheffl commented Feb 8, 2026

FYI tests fail on the same problem that I attempt to fix in #61651 ... probably unrelated to this PR.

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.

2 participants