我如何了解有关为什么我的Laravel排队作业失败的更多信息? [英] How can I learn more about why my Laravel Queued Job failed?

查看:48
本文介绍了我如何了解有关为什么我的Laravel排队作业失败的更多信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情况

我正在使用Laravel Queues处理大量媒体文件,单个工作预计要花几分钟的时间(最多可以说一个小时).

I'm using Laravel Queues to process large numbers of media files, an individual job is expected to take minutes (lets just say up to an hour).

我正在使用Supervisor运行我的队列,并且我一次运行20个进程.我的主管配置文件如下所示:

I am using Supervisor to run my queue, and I am running 20 processes at a time. My supervisor config file looks like this:

[program:duplitron-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/duplitron/artisan queue:listen database --timeout=0 --memory=500 --tries=1
autostart=true
autorestart=true
user=duplitron
numprocs=20
redirect_stderr=true
stdout_logfile=/var/www/duplitron/storage/logs/duplitron-worker.log

在我的 duplitron-worker.log 中,我发现 Failed:Illuminate \ Queue \ CallQueuedHandler @ call 偶尔发生,我想更好地了解到底是什么失败了.什么都没有出现在我的laravel.log文件中(通常会出现异常).

In my duplitron-worker.log I noticed Failed: Illuminate\Queue\CallQueuedHandler@call occurs occasionally and I would like to better understand what exactly is failing. Nothing appears in my laravel.log file (which is where exceptions would normally appear).

问题

我是否可以方便地了解导致工作失败的原因?

Is there a handy way for me to learn more about what is causing my job to fail?

推荐答案

在较新的Laravel版本中, failed_jobs 表中有一个 exception 列,其中包含您的所有信息需要.感谢cdarken和Toskan指出这一点!

In the newer Laravel versions there's an exception column in the failed_jobs table that has all the info you need. Thanks cdarken and Toskan for pointing this out!

====下面的旧方法

==== OLD METHOD BELOW

这是我一直在做的事情,但首先-确保您有一张工作失败表!有据可查,请查找:)

Here's what I always do, but first - make sure you have a failed-jobs table! It's well documented, look it up :)

  1. 运行 php artisan queue:failed 命令以列出所有失败的作业,然后选择要执行的作业.写下ID.

  1. Run the php artisan queue:failed command to list all the failed jobs, and pick the one you're after. Write the ID down.

然后,请确保使用 supervisorctl停止所有duplitron-worker的队列:

最后,请确保 APP_DEBUG = true的.env设置.

Lastly, make sure your .env setting for APP_DEBUG = true.

然后运行 php artisan queue:retry {step_job_1_id}

现在手动运行 php artisan queue:listen --timeout = XXX

如果错误是结构性错误(大部分是错误),则应在日志文件中获取调试堆栈失败的信息.

If the error is structural (and most are), you should get the failure with debug stack in your log file.

祝您调试顺利:-)

这篇关于我如何了解有关为什么我的Laravel排队作业失败的更多信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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