How can I redirect all logs from rufus-scheduler to log/production.log?
For example, in console I can see something like that:
↳ config/initializers/XXX_scheduler.rb:15
{ 70173962355140 rufus-scheduler intercepted an error:
70173962355140 job:
70173962355140 Rufus::Scheduler::CronJob "43 12 * * *" {}
70173962355140 error:
70173962355140 70173962355140
70173962355140 NoMethodError
70173962355140 undefined method passenger_user for nil:NilClass
...
I found this error text in puma error (puma.error.log) file on production. Part of deploy.rb:
set :puma_error_log, "#{release_path}/log/puma.error.log"
How can I redirect all logs related to rufus-scheduler to production.log?
Sorry for the late answer.
What you are seeing is the output of
Scheduler#on_error. By default it outputs to stderr.This destination can be overriden as explained in the readme but it's probably better to override
#on_error, as detailed in the readme as well.Your
#on_errormight thus look likeand thus simply piggyback Rails logging infrastructure.
The original #on_error is quite detailed. Feel free to take inspiration from it if you need more debugging information.