aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/queueing.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/queueing.rb b/activesupport/lib/active_support/queueing.rb
index 6de038ee0e..064f009f13 100644
--- a/activesupport/lib/active_support/queueing.rb
+++ b/activesupport/lib/active_support/queueing.rb
@@ -64,9 +64,12 @@ module ActiveSupport
# queue and joins the thread, which will ensure that all jobs
# are executed before the process finally dies.
class ThreadedQueueConsumer
+ attr_accessor :logger
+
def initialize(queue, options = {})
@queue = queue
- @logger = options[:logger] || Logger.new($stderr)
+ @logger = options[:logger]
+ @fallback_logger = Logger.new($stderr)
end
def start
@@ -96,7 +99,7 @@ module ActiveSupport
end
def handle_exception(job, exception)
- @logger.error "Job Error: #{job.inspect}\n#{exception.message}\n#{exception.backtrace.join("\n")}"
+ (logger || @fallback_logger).error "Job Error: #{job.inspect}\n#{exception.message}\n#{exception.backtrace.join("\n")}"
end
end
end