Reputation: 16393
If I start my background worker for delayed_job, and then submit a job, the job runs but I do not see any terminal output from the job. How do I arrange it so I can see terminal output. I am using ruby on rails in development mode.
I want to do this when I when issue the command bin/delayed_job start
.
Upvotes: 2
Views: 1920
Reputation: 4468
Use the bin/rails jobs:work
command in a separate terminal window. It will start processing jobs in that terminal without exiting.
If you've put breakpoints or puts
statements in your job, you'll see them in the terminal.
Stop the process using CTRL-C
.
Hope that helps.
Upvotes: 0
Reputation: 16393
As suggested by Gene and Shani, you can set up a logger by adding
Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'delayed_job.log'))
to config/initializers/delayed_job_initializers.rb
and then in the running process output using
Delayed::Worker.logger.debug("Log Entry")
and then viewing the output using
tail -f log/delayed_job.log.
Upvotes: 2
Reputation: 2541
you can start worker on a rails console. what I do when I want to debug delayed job is
worker = Delayed::Worker.new
worker.start
Upvotes: 1