Django celery如何打印或检查tas的日志记录

2024-04-24 17:23:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我现在有了姜果和芹菜。但是没有日志打印让我检查任务是否正常工作。我正在使用mac,并计划在我的ubuntu aws机器上使用芹菜。在

这就是我的工作任务.py公司名称:

import string
from celery import shared_task
import logging
@shared_task
def send_push_notification_celery(total):
    logging.debug("send_push_notification_celery")
    logging.debug("total:%d", total)
    return "i love you"

以下是celery worker控制台上打印的所有内容:

^{pr2}$

Tags: debugimportawssendtaskubuntumaclogging
1条回答
网友
1楼 · 发布于 2024-04-24 17:23:26

您可以使用普通pythonprint将数据从celery任务输出到控制台:

def send_push_notification_celery(total):
    print("send_push_notification_celery")
    print("total:%d", total)
    return "i love you"

相关问题 更多 >