问题
Is it possible to customize the format that Airflow uses for logging?
I tried adding a LOG_FORMAT variable in $AIRFLOW_HOME/airflow.cfg, but it doesn't seem to take effect
LOG_FORMAT = "%(asctime)s logLevel=%(levelname)s logger=%(name)s - %(message)s"
回答1:
You need to change the settings.py file in the airflow package to change the log format
Update settings.py (after LOGGING_LEVEL add below line):
LOG_FORMAT = os.path.expanduser(conf.get('core', 'LOG_FORMAT'))
Update airflow.cfg configuration file: Add line under [core]:
LOG_FORMAT = "%(asctime)s logLevel=%(levelname)s logger=%(name)s - %(message)s"
Restart webserver and scheduler services
Try the approach as mentioned in the answer here to change logging level
来源:https://stackoverflow.com/questions/42141842/apache-airflow-customize-logging-format