Apache Airflow version
2.2.2 (latest released)
What happened
- (1). When I set airflow.cfg with:
default_ui_timezone = Asia/Shanghai
default_timezone = Asia/Shanghai
- (2). start weserver and scheduler
- (3). trigger "example_bash_operator" task manually
- (4). in upper right corner select ui display timezone with "CST +(08:00)"
- (5). I find task log time in web page is wrong, it faster 8 hours than it real is.
What you expected to happen
- In web page it shdould display the correct log time.
How to reproduce
- As described In "What happened".
- I think this is cause by the logger use localtime but not UTC. Why should we save all time with UTC in database but localtime in log?
Operating System
Ubuntu 20
Versions of Apache Airflow Providers
apache-airflow-providers-ftp==2.0.1
apache-airflow-providers-http==2.0.1
apache-airflow-providers-imap==2.0.1
apache-airflow-providers-sqlite==2.0.1
Deployment
Other
Deployment details
pip freeze | grep apache-airflow-providers
Anything else
I think it's can be fixed by add a UTCFromatter for logger.
edit file "airflow/airflow/config_templates/airflow_local_settings.py"
+import logging
+import time
+
+class UTCFormatter(logging.Formatter):
+ converter = time.gmtime
+
DEFAULT_LOGGING_CONFIG: Dict[str, Any] = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
- 'airflow': {'format': LOG_FORMAT},
+ 'airflow': {'()': UTCFormatter, 'format': LOG_FORMAT},
Are you willing to submit PR?
Code of Conduct
Apache Airflow version
2.2.2 (latest released)
What happened
default_ui_timezone = Asia/Shanghai
default_timezone = Asia/Shanghai
What you expected to happen
How to reproduce
Operating System
Ubuntu 20
Versions of Apache Airflow Providers
apache-airflow-providers-ftp==2.0.1
apache-airflow-providers-http==2.0.1
apache-airflow-providers-imap==2.0.1
apache-airflow-providers-sqlite==2.0.1
Deployment
Other
Deployment details
pip freeze | grep apache-airflow-providers
Anything else
I think it's can be fixed by add a UTCFromatter for logger.
edit file "airflow/airflow/config_templates/airflow_local_settings.py"
Are you willing to submit PR?
Code of Conduct