Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change the logging level of delayed_job separately from the main Rails app?

I'd like to use the DEBUG logging level for my Rails app on our staging server, but I'd like delayed_job (which logs a SELECT statement to the main Rails log every 10 seconds) to log at INFO level, so I don't get these delayed_job SELECT statements in there.

Is this possible?

like image 970
Olly Avatar asked Dec 23 '09 13:12

Olly


2 Answers

RAILS_DEFAULT_LOGGER is deprecated in 3.x versions of Rails, so you'll need to use the following in script/delayed_job before the Delayed::Command.new(ARGV).daemonize call:

::Rails.logger.level = Logger::INFO
like image 170
stringsn88keys Avatar answered Oct 13 '22 09:10

stringsn88keys


I just ran into this. What I did in my script that runs Delayed::Job.worker.start was to add, before the worker starts:

RAILS_DEFAULT_LOGGER.level = Logger::INFO

This worked for me.

like image 21
Jason Yanowitz Avatar answered Oct 13 '22 11:10

Jason Yanowitz