Apache Airflow - customize logging format

a 夏天 提交于 2020-01-02 05:43:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!