hanxdatadog opened a new issue, #68912:
URL: https://github.com/apache/airflow/issues/68912
**Apache Airflow version:**
3.x
**Is your feature request related to a problem?**
Setting `AIRFLOW__LOGGING__JSON_LOGS=True` has no effect on the Celery
worker's stdout. The worker always emits plain-text logs. Other components (API
server, core logging) already respect this setting, but `celery_command.py`
calls `configure_logging` without passing `json_output`:
```python
if AIRFLOW_V_3_0_PLUS:
from airflow.sdk.log import configure_logging
configure_logging(output=sys.stdout.buffer) # json_output defaults to
False
```
**Proposed solution**
Add a `[celery] json_logs` option for a celery-specific override, falling
back to the existing `[logging] json_logs` — consistent with how `[logging]
CELERY_LOGGING_LEVEL` / `[logging] LOGGING_LEVEL` already work in the same file:
```python
if AIRFLOW_V_3_0_PLUS:
from airflow.sdk.log import configure_logging
json_output = conf.getboolean("celery", "json_logs", fallback=None)
if json_output is None:
json_output = conf.getboolean("logging", "json_logs", fallback=False)
configure_logging(output=sys.stdout.buffer, json_output=json_output)
```
**Changes required:**
- `providers/celery/src/airflow/providers/celery/cli/celery_command.py` —
the lookup above
- Celery provider config schema — add `[celery] json_logs` option
**Who would benefit?**
Operators running the Celery executor on Kubernetes or any platform that
routes worker stdout to a structured log collector.
**Are you willing to submit a PR?**
Yes.
--
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]