为 Laravel 4 队列侦听器启用详细模式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15822974/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 07:40:29  来源:igfitidea点击:

Enable Verbose mode for Laravel 4 Queue Listener

phpqueuelaravellaravel-4

提问by Nyxynyx

When running the Listener via php artisan queue:listen, its pretty quiet even though the Worker may be echoing something.

当通过 运行侦听器时php artisan queue:listen,即使 Worker 可能正在回显某些内容,它也非常安静。

Question:How do you enable those echos to be displayed on the screen, similar to how php artisan queue:workdoes it?

问题:如何让那些回声显示在屏幕上,类似怎么php artisan queue:work做?

回答by Phill Sparks

I don't believe that listen is meant to have any output, and I can't see anything in the ListenCommandthat would suggest there's any more output to give. However, when you ask artisan for help it suggests --verbose (-v)which you could give a try?

我不相信 listen 意味着有任何输出,而且我在ListenCommand 中看不到任何表明还有更多输出的内容。但是,当您向工匠寻求帮助时,它会建议--verbose (-v)您可以尝试哪些?

php artisan queue:listen -v

My understanding of listen is that it is designed to be run as a background service, essentially calling queue:workrepeatedly. If you wanted to test that a worker is working you'd just call queue:workyourself. You probably want to look at adding some loggingto your code, and you'll be able to look in the log files then.

我对listen的理解是它被设计为作为后台服务运行,本质上是queue:work重复调用。如果你想测试一个工人是否在工作,你只需给queue:work自己打电话。您可能希望在代码中添加一些日志记录,然后您就可以查看日志文件了。



$ php artisan help queue:listen

Usage:
 queue:listen [--queue[="..."]] [--delay[="..."]] [--memory[="..."]] [--timeout[="..."]] [connection]

Arguments:
 connection            The name of connection

Options:
 --queue               The queue to listen on
 --delay               Amount of time to delay failed jobs (default: 0)
 --memory              The memory limit in megabytes (default: 128)
 --timeout             Seconds a job may run before timing out (default: 60)
 --help (-h)           Display this help message.
 --quiet (-q)          Do not output any message.
 --verbose (-v)        Increase verbosity of messages.
 --version (-V)        Display this application version.
 --ansi                Force ANSI output.
 --no-ansi             Disable ANSI output.
 --no-interaction (-n) Do not ask any interactive question.
 --env                 The environment the command should run under.> 
$ php artisan help queue:listen

Usage:
 queue:listen [--queue[="..."]] [--delay[="..."]] [--memory[="..."]] [--timeout[="..."]] [connection]

Arguments:
 connection            The name of connection

Options:
 --queue               The queue to listen on
 --delay               Amount of time to delay failed jobs (default: 0)
 --memory              The memory limit in megabytes (default: 128)
 --timeout             Seconds a job may run before timing out (default: 60)
 --help (-h)           Display this help message.
 --quiet (-q)          Do not output any message.
 --verbose (-v)        Increase verbosity of messages.
 --version (-V)        Display this application version.
 --ansi                Force ANSI output.
 --no-ansi             Disable ANSI output.
 --no-interaction (-n) Do not ask any interactive question.
 --env                 The environment the command should run under.> 

回答by phirschybar

php artisan queue:listennow does render the worker output to the console when run. No verbose mode needed.

php artisan queue:listen现在确实在运行时将工作器输出呈现到控制台。不需要详细模式。

回答by Kebian

Listen is very quiet. Personally, I use OS X / Linux and run the following in another terminal window to monitor the output.

听着很安静。就个人而言,我使用 OS X / Linux 并在另一个终端窗口中运行以下命令来监视输出。

tail -f storage/logs/*