Abdulrehman-PIAIC80387 opened a new pull request, #68660: URL: https://github.com/apache/airflow/pull/68660
The API server did not respect `logging.colored_console_log`. Setting `AIRFLOW__LOGGING__COLORED_CONSOLE_LOG=False` left the API server emitting ANSI color escape sequences, which are hard to read in log aggregators that don't render colors. The root cause is the same one #54992 fixed for the Triggerer: the process never called `configure_logging()`, so structlog fell back to its default (`colors=True`) and ignored the `colored_console_log` config. #54992 fixed the Triggerer but left the API server (the second process named in #54962) unaddressed. ## Fix Call `configure_logging()` in `airflow.api_fastapi.main`, the module that **both** uvicorn and gunicorn import in every worker process (uvicorn runs `main:app`; gunicorn's worker `load()` does `from airflow.api_fastapi.main import app`). `configure_logging()` reads `logging.colored_console_log` from config, so the API server now honors it. ## Design notes - The call is placed in the per-worker entrypoint rather than the CLI master process (`_run_api_server`) on purpose: uvicorn/gunicorn load the app independently in each worker, so configuring logging only in the master would not reach the worker processes that actually emit the request/app logs. - This mirrors the approach merged in #54992 for the Triggerer. ## Tests Added `test_main.py` asserting `configure_logging()` is invoked when the worker entrypoint is loaded. closes: #54962 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Mirza Generated-by: Mirza following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
