Skip to content

Instantly share code, notes, and snippets.

@terut
Created December 6, 2011 04:35
Show Gist options
  • Save terut/1436759 to your computer and use it in GitHub Desktop.
Save terut/1436759 to your computer and use it in GitHub Desktop.
Customize DelayedJob's logger.
# if you wanna use syslog, you can rewrite by syslogger.
if Rails.env.production?
module Delayed::Backend::ActiveRecord
class Job
class << self
def after_fork
logger = Syslogger.new("#{Rails.env}.delayed_job", Syslog::LOG_PID, Syslog::LOG_LOCAL2)
Rails.logger = logger
Delayed::Worker.logger = logger
# can't call super
::ActiveRecord::Base.establish_connection
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment