Writing to Airflow Logs

懵懂的女人 提交于 2019-12-18 12:48:06

问题


One way to write to the logs in Airflow is to return a string from a PythonOperator like on line 44 here.

Are there other ways that allow me to write to the airflow log files? I've found that print statements are not saved to the logs.


回答1:


You can import the logging module into your code and write to logs that way

import logging

logging.info('Hello')

Here are some more options

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')


来源:https://stackoverflow.com/questions/40120474/writing-to-airflow-logs

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