将日志添加到气流日志 [英] Adding logs to Airflow Logs

查看:91
本文介绍了将日志添加到气流日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将自己的日志添加到自动生成的Apache Airflow日志中?任何打印语句都不会在那里登录,所以我想知道如何添加日志以使其也显示在UI上?

How can I add my own logs onto the Apache Airflow logs that are automatically generated? any print statements wont get logged in there, so I was wondering how I can add my logs so that it shows up on the UI as well?

推荐答案

我认为您可以通过使用日志记录模块并将配置信任于Airflow来解决此问题.

I think you can work around this by using the logging module and trusting the configuration to Airflow.

类似的东西:

import ...

dag = ...

def print_params_fn(**kwargs):
    import logging
    logging.info(kwargs)
    return None

print_params = PythonOperator(task_id="print_params",
                              python_callable=print_params_fn,
                              provide_context=True,
                              dag=dag)

这篇关于将日志添加到气流日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆