ruby-on-railsdelayed-job

See output from background task run with delayed_job


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.


Solution

  • 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.