Skip to content

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

Open
turanalmammadov wants to merge 1 commit intoapache:mainfrom
turanalmammadov:fix/improve-plugin-log-messages
Open

fix: improve plugin loading log messages to distinguish empty folder from errors#62819
turanalmammadov wants to merge 1 commit intoapache:mainfrom
turanalmammadov:fix/improve-plugin-log-messages

Conversation

@turanalmammadov
Copy link

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

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
@boring-cyborg
Copy link

boring-cyborg bot commented Mar 3, 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

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

1 participant