Permalink
Browse files

instrumenter can't be cached because the app could be called from

different threads.
  • Loading branch information...
1 parent 6b49da3 commit 64ba1ab09bb2514bea9bf426bb83fd97fe7c6b68 @tenderlove tenderlove committed Oct 5, 2013
Showing with 4 additions and 3 deletions.
  1. +4 −3 railties/lib/rails/rack/logger.rb
@@ -11,7 +11,6 @@ class Logger < ActiveSupport::LogSubscriber
def initialize(app, taggers = nil)
@app = app
@taggers = taggers || []
- @instrumenter = ActiveSupport::Notifications.instrumenter
end
def call(env)
@@ -33,7 +32,8 @@ def call_app(request, env)
logger.debug ''
end
- @instrumenter.start 'request.action_dispatch', request: request
+ instrumenter = ActiveSupport::Notifications.instrumenter
+ instrumenter.start 'request.action_dispatch', request: request
logger.info started_request_message(request)
resp = @app.call(env)
resp[2] = ::Rack::BodyProxy.new(resp[2]) { finish(request) }
@@ -70,7 +70,8 @@ def compute_tags(request)
private
def finish(request)
- @instrumenter.finish 'request.action_dispatch', request: request
+ instrumenter = ActiveSupport::Notifications.instrumenter
+ instrumenter.finish 'request.action_dispatch', request: request
end
def development?

0 comments on commit 64ba1ab

Please sign in to comment.