写入Airflow日志

问题描述 投票:17回答:1

写入Airflow中的日志的一种方法是从第44行here上的PythonOperator返回一个字符串。

还有其他方法可以写入气流日志文件吗?我发现print语句没有保存到日志中。

airflow
1个回答
24
投票

您可以将日志记录模块导入代码并以这种方式写入日志

import logging

logging.info('Hello')

这里有一些更多的选择

import logging    

logging.debug('This is a debug message')
logging.info('This is an info message')
logging.warning('This is a warning message')
logging.error('This is an error message')
logging.critical('This is a critical message')
© www.soinside.com 2019 - 2024. All rights reserved.