简体   繁体   English

将 rake 后台任务保存到日志? (使用Resque)

[英]Save rake background task to log? (Using Resque)

This is very simple I guess, but still.. I have a background task with Resque that is failing and the output is too long to see in Terminal window.. I think it's time to log it.我想这很简单,但仍然……我有一个 Resque 的后台任务失败了,output 太长了,无法在终端 window 中看到。我认为是时候记录它了。 I execute it through我执行它

bundle exec env rake resque:work QUEUE='*'

Question is - how do I save that output to log file?问题是 - 如何将 output 保存到日志文件?

I looked at logging (development.log and it's not showing there of course, b/c it's happening on rake side)...我查看了日志记录(development.log 并且它当然没有显示在那里,b/c 它发生在 rake 端)...

Thanks!谢谢!

Take a look at this pull request:看看这个拉取请求:

https://github.com/sj26/resque/commit/05e4c5e6f92fe62b25db40984b20dad4b9f870d8 https://github.com/sj26/resque/commit/05e4c5e6f92fe62b25db40984b20dad4b9f870d8

And read the readme.并阅读自述文件。 Have you tried to set VVERBOSE=1?您是否尝试设置 VVERBOSE=1?


You could just send the output to a file:您可以将 output 发送到一个文件:

bundle exec env rake resque:work QUEUE='*' >> log/resque.log

I run resque like that on my server我在我的服务器上运行 resque

nohup bundle exec rake resque:work QUEUE=general PIDFILE=tmp/pids/resque_worker_QUEUE.pid & >> log/resque_worker_QUEUE.log 2>&1

Can't tell you it's the best way, but it works.不能告诉你这是最好的方法,但它确实有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM