获取芹菜的默认日志

时间:2019-02-22 11:38:17

标签: python django celery

如果不使用终端和使用python代码,我将无法访问芹菜的默认日志。可以使用-f通过终端获得它。想要使用python脚本获取文件中的日志,也要获取由celery在stderr中生成的默认日志。

2 个答案:

答案 0 :(得分:0)

如果您使用的是 python文件,则可以通过以下方式获取记录器。您可以将文件处理程序添加到logger

from celery.utils.log import get_task_logger

logger = get_task_logger(__name__)

对于默认的芹菜日志,您可以在 celery工人运行命令

中添加以下内容
-f LOGFILE, --logfile=LOGFILE
                    Path to log file. If no logfile is specified, stderr
                    is used.

答案 1 :(得分:0)

您尝试过使用芹菜花吗?

这是一个Web界面,用于监视和检查队列及其任务。

https://flower.readthedocs.io/en/latest/

相关问题