Logging in delayed_job?

When I needed log output from Delayed Jobs, I found this question to be fairly helpful.

In config/initializers/delayed_job.rb I add the line:

Delayed::Worker.logger = Logger.new(File.join(Rails.root, 'log', 'dj.log'))

Then, in my job, I output to this log with:

Delayed::Worker.logger.info("Log Entry")

This results in the file log/dj.log being written to. This works in development, staging, and production environments.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)