Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "Set RAILS_DEFAULT_LOGGER before loading Rails in the command …

…line script", since we lose the log level by doing it this way

This reverts commit c43dba9.
  • Loading branch information...
commit 7d94a006813572804f8bb09a8020f1a95e8906ab 1 parent c43dba9
@bkeepers bkeepers authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/delayed/command.rb
View
11 lib/delayed/command.rb
@@ -1,7 +1,6 @@
require 'rubygems'
require 'daemons'
require 'optparse'
-require 'logger'
module Delayed
class Command
@@ -45,10 +44,16 @@ def daemonize
def run(worker_name = nil)
Dir.chdir(RAILS_ROOT)
- # Set the default logger
- Object.const_set :RAILS_DEFAULT_LOGGER, Logger.new(File.join(RAILS_ROOT, 'log', 'delayed_job.log'))
require File.join(RAILS_ROOT, 'config', 'environment')
+
+ # Replace the default logger
+ logger = Logger.new(File.join(RAILS_ROOT, 'log', 'delayed_job.log'))
+ logger.level = ActiveRecord::Base.logger.level
+ ActiveRecord::Base.logger = logger
+ ActiveRecord::Base.clear_active_connections!
+ Delayed::Worker.logger = logger
Delayed::Job.worker_name = "#{worker_name} #{Delayed::Job.worker_name}"
+
Delayed::Worker.new(@options).start
rescue => e
logger.fatal e
Please sign in to comment.
Something went wrong with that request. Please try again.