Resque记录器:不打印活动记录错误

时间:2019-03-04 16:49:16

标签: ruby-on-rails ruby-on-rails-5 resque ruby-on-rails-5.2

我注意到resque记录器没有打印ActiveRecord错误,这样我可以清楚地看到是否通过“ Rails控制台”手动触发了该方法。 如何将所有内容打印到STDOUT?

ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint 

config / initializers / resque.rb

rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'
config_file = rails_root + '/config/resque.yml'

resque_config = YAML::load(ERB.new(IO.read(config_file)).result)
Resque.redis = resque_config[rails_env]

Resque.logger = Rails.logger
Resque.logger.level = Logger::DEBUG

Resque worker

QUEUE=* rake resque:work

0 个答案:

没有答案