Edit Scheduler Log Do Not Write to Log File

I have an application with resque and resque-scheduler settings. All tasks run normally and result in logs in the log file. Resque-scheduler alos works fine, loads and processes jobs as expected.

The only problem I ran into is that the scheduler does not seem to write anything to its log file.

I followed the installation instructions here

https://github.com/resque/resque-scheduler#logging

And this code is in my initializer.

# Define the location of the schedule
Resque.schedule = YAML.load_file(Rails.root.join('config', 'scheduled_jobs.yml'))

# Define the logger
Resque::Scheduler.configure do |c|
  c.quiet = false
  c.verbose = false
  c.logfile = File.open("#{Rails.root}/log/resque_scheduler.log", 'w+')
  c.logformat = 'text'
end

When the application starts, resque_scheduler.log is created.

When I run the scheduler, it displays the following on stdout (terminal window on my virtual machine). I expected this to go into the log file.

$ rake resque:scheduler TERM_CHILD=1
resque-scheduler: [INFO] 2015-07-17T14:34:27+01:00: Starting
resque-scheduler: [INFO] 2015-07-17T14:34:27+01:00: Loading Schedule
resque-scheduler: [INFO] 2015-07-17T14:34:27+01:00: Scheduling daily_job_email_overdue_items_to_admin 
resque-scheduler: [INFO] 2015-07-17T14:34:27+01:00: Scheduling daily_job_to_update_status_to_overdue 
resque-scheduler: [INFO] 2015-07-17T14:34:27+01:00: Schedules Loaded

, . , , .

.

+4
1

LOGFILE . , . rake , , .

rake resque:scheduler LOGFILE=./log/resque_scheduler.log

, . , , resque .

+7

Source: https://habr.com/ru/post/1598382/


All Articles