airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Colored_console_log=False not affecting all Airflow processes

Open o-nikolas opened this issue 1 year ago • 1 comments

Apache Airflow version

main (development)

If "Other Airflow 2 version" selected, which one?

No response

What happened?

I was attempting to disable colored logs that we have with the new struct logging (since where I'm uploading the logs doesn't support colors and the show as terminal escape sequences which are difficult to read). But when setting AIRFLOW__LOGGING__COLORED_CONSOLE_LOG=False only some of the Airflow processes respect this configuration. The API server and Triggerer seem to ignore the disabled colors.

Color Enabled:

Image

Color Disabled:

Image

What you think should happen instead?

All processes should log to stdout with no color

How to reproduce

Start and Airflow environment with and without this option set and observe the differences (in my case I used breeze).

Operating System

Linux Dockerized

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • [x] Yes I am willing to submit a PR!

Code of Conduct

o-nikolas avatar Aug 26 '25 22:08 o-nikolas

Proposed solution:

The configuration should be applied at the shared logging setup boundary used by every Airflow process, rather than only by the processes that currently initialize the console renderer with colored_console_log. The API server and Triggerer should receive the same resolved value as the scheduler, workers, and DAG processor.

A focused implementation would be:

  1. Trace where the structlog/console renderer is built for the API server and Triggerer.
  2. Route those paths through the common logging configuration and use [logging] colored_console_log when constructing the renderer.
  3. Keep the current default unchanged.
  4. Add regression tests that initialize each affected process logger with the option set to False and assert that emitted stdout contains no ANSI color sequences; also retain a test that True preserves the existing behavior.

The important part is testing process-specific logger initialization, since the setting already works for some processes and the regression is in the remaining startup paths.

senapati484 avatar Nov 29 '26 13:11 senapati484