Apache Airflow-自定义日志记录格式 [英] Apache Airflow - customize logging format
问题描述
是否可以自定义Airflow用于记录的格式?
Is it possible to customize the format that Airflow uses for logging?
我尝试在$ AIRFLOW_HOME / airflow.cfg中添加一个LOG_FORMAT变量,但没有似乎生效
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"
推荐答案
您需要更改气流包装中的settings.py文件以更改日志格式
You need to change the settings.py file in the airflow package to change the log format
-
更新 settings.py (在LOGGING_LEVEL之后添加以下行):
Update settings.py (after LOGGING_LEVEL add below line):
LOG_FORMAT = os.path.expanduser(conf.get('core','LOG_FORMAT'))
LOG_FORMAT = os.path.expanduser(conf.get('core', 'LOG_FORMAT'))
更新 airflow.cfg 配置文件:
在[core]下添加行:
Update airflow.cfg configuration file: Add line under [core]:
LOG_FORMAT =%(asctime)s logLevel =%(levelname)s logger =%(name)s-%(message)s
LOG_FORMAT = "%(asctime)s logLevel=%(levelname)s logger=%(name)s - %(message)s"
重启网络服务器和调度程序服务
尝试使用答案此处更改日志记录级别
Try the approach as mentioned in the answer here to change logging level
这篇关于Apache Airflow-自定义日志记录格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!