【发布时间】:2016-05-11 12:43:56
【问题描述】:
如果我在 perform() 中登录,我会得到一个漂亮的输出:
def perform(*args)
begin
MyActivity.run(*args)
rescue StandardError => e
Rails.logger.debug e
raise e
end
end
13:55:10 resque.1 | [ActiveJob] [MyJob] [18cd0f78-d784-48a7-a573-0b3aa95c51cc] Connection refused - connect(2) for "fe80::1%lo0" port 3000
如果我在rescue_from 块内登录,我不会得到ActiveJob 或JobId 的标签/标签
rescue_from(StandardError) do |e|
Rails.logger.debug e
end
13:55:11 resque.1 | Connection refused - connect(2) for "fe80::1%lo0" port 3000
我认为在 rescue_from 块上,作业已经终止,所以我们不再有 JobId。
有没有办法像perform 中的日志一样获取输出?
【问题讨论】:
标签: ruby-on-rails logging resque rails-activejob