Skip to content

fix: improve plugin loading log messages to distinguish empty folder from errors - #62819

Closed
turanalmammadov wants to merge 1 commit into
apache:mainfrom
turanalmammadov:fix/improve-plugin-log-messages
Closed

turanalmammadov wants to merge 1 commit into
apache:mainfrom
turanalmammadov:fix/improve-plugin-log-messages

Conversation

@turanalmammadov

Copy link
Copy Markdown

Motivation

Closes #56816

The current logging in plugins_manager.py has one generic timing debug message regardless of whether:

  • the plugins folder is empty (no plugins to load — normal operation)
  • plugins failed to import (errors occurred)

This makes it hard for operators and developers to quickly understand the plugin loading state.

Changes

Updated _get_plugins() in airflow-core/src/airflow/plugins_manager.py:

Before:

log.debug("Loading %d plugin(s) took %.2f ms", len(plugins), timer.duration)

After:

if import_errors:
    log.warning(
        "Failed to load %d plugin(s): %s",
        len(import_errors),
        list(import_errors.keys()),
    )
elif not plugins:
    log.debug("No plugins loaded (plugins folder is empty or contains no Airflow plugins)")
else:
    log.debug("Loading %d plugin(s) took %.2f ms", len(plugins), timer.duration)

Why this approach

  1. Import errors are elevated to WARNING so they are visible in default log configurations and clearly list which plugins failed — making debugging much easier.
  2. Empty plugins folder gets a clear DEBUG message so developers inspecting debug logs can understand why no plugins are active.
  3. Successful loads retain the existing timing message (no regression).

Testing

The change is straightforward — no new tests needed as the logic is covered by existing plugin loading tests.

Made with Cursor

@boring-cyborg

boring-cyborg Bot commented Mar 3, 2026

Copy link
Copy Markdown

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: [email protected]
    Slack: https://s.apache.org/airflow-slack

Previously, when no plugins were present in the plugins folder, the
loading summary log was identical to a successful load. This made it
hard to distinguish between an empty plugin directory and errors.

Changes:
- When import_errors exist: emit a WARNING listing all failing plugin
  paths so operators can quickly see what broke
- When no plugins and no errors: emit a clear DEBUG message indicating
  the plugins folder is empty / contains no Airflow plugins
- When plugins are loaded successfully: keep the existing debug timing
  message

Closes apache#56816

Made-with: Cursor
@potiuk
potiuk force-pushed the fix/improve-plugin-log-messages branch from e22cb35 to 0755c27 Compare April 2, 2026 17:15
@potiuk potiuk added the ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. label Apr 2, 2026
@potiuk
potiuk marked this pull request as draft May 6, 2026 10:59
@potiuk

potiuk commented May 6, 2026

Copy link
Copy Markdown
Member

@turanalmammadov This PR has had no activity for 5 weeks. Converting to draft to signal that maintainer review is paused until you resume work.

When you're ready to continue, please rebase onto the current main branch, address any newly-appearing CI failures, and mark the PR as "Ready for review" again. There is no rush.


Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you.

@potiuk potiuk removed the ready for maintainer review Set by triage when all criteria pass, or by the fork CI reconciler when fork CI is green. label May 18, 2026
@potiuk

potiuk commented Jun 1, 2026

Copy link
Copy Markdown
Member

@turanalmammadov This draft PR has had no activity for 2 weeks. Closing to keep the queue clean.

You are welcome to reopen and continue when you're ready. If you'd like to pick it back up, please rebase onto the current main branch first.


Note: This comment was drafted by an AI-assisted triage tool and may contain mistakes. Once you have addressed the points above, an Apache Airflow maintainer — a real person — will take the next look at your PR. We use this two-stage triage process so that our maintainers' limited time is spent where it matters most: the conversation with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve log when there are no plugins to load

2 participants