You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ShubhamGondane (via GitHub)" <gi...@apache.org> on 2026/03/11 01:32:20 UTC

[PR] Add log_timestamp_format config option for component log timestamps [airflow]

ShubhamGondane opened a new pull request, #63321:
URL: https://github.com/apache/airflow/pull/63321

   ## Problem
   
   Reported in #62937: users trying to customize timestamp formats for component logs
   (scheduler, api-server, triggerer, etc.) via `AIRFLOW__LOGGING__LOG_FORMATTER_CLASS`
   or `AIRFLOW__LOGGING__LOGGING_CONFIG_CLASS` found that neither setting had any effect.
   
   As identified in the issue thread, the root cause is that structlog unconditionally
   strips user-configured formatters and hardcodes the timestamp as `fmt="iso"` in
   `MaybeTimeStamper`. `LOG_FORMATTER_CLASS` only applies to task/DAG logs (the stdlib
   logging pipeline), never to component logs rendered via structlog. The setting was
   documented with no caveat, silently doing nothing and confusing users.
   
   ## Fix
   
   - Added a new `log_timestamp_format` config option under `[logging]` (default: `iso`)
   - Exposed the previously hardcoded `fmt="iso"` in `MaybeTimeStamper` as this config value
   - Updated the `log_formatter_class` description to document that it does NOT affect
     component logs and to point users to `log_timestamp_format` instead
   
   ## Usage
   
   ```ini
   [logging]
   log_timestamp_format = %Y-%m-%d %H:%M:%S
   ```
   
   or via environment variable:
   
   ```bash
   AIRFLOW__LOGGING__LOG_TIMESTAMP_FORMAT="%Y-%m-%d %H:%M:%S"
   ```
   
   Accepts `iso` (ISO 8601, the default) or any Python strftime format string.
   Only affects component logs (scheduler, api-server, triggerer, dag-processor).
   Task/DAG logs continue to use `LOG_FORMAT` with `%(asctime)s`.
   
   closes: #62937


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add log_timestamp_format config option for component log timestamps [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk merged PR #63321:
URL: https://github.com/apache/airflow/pull/63321


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org