aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/rack/logger.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/rack/logger.rb')
-rw-r--r--railties/lib/rails/rack/logger.rb18
1 files changed, 7 insertions, 11 deletions
diff --git a/railties/lib/rails/rack/logger.rb b/railties/lib/rails/rack/logger.rb
index 91a613092f..de21fb4f10 100644
--- a/railties/lib/rails/rack/logger.rb
+++ b/railties/lib/rails/rack/logger.rb
@@ -9,27 +9,23 @@ module Rails
end
def call(env)
- @env = env
- before_dispatch
- result = @app.call(@env)
- after_dispatch
- result
+ before_dispatch(env)
+ @app.call(env)
+ ensure
+ after_dispatch(env)
end
protected
- def request
- @request ||= ActionDispatch::Request.new(@env)
- end
-
- def before_dispatch
+ def before_dispatch(env)
+ request = ActionDispatch::Request.new(env)
path = request.request_uri.inspect rescue "unknown"
info "\n\nStarted #{request.method.to_s.upcase} #{path} " <<
"for #{request.remote_ip} at #{Time.now.to_s(:db)}"
end
- def after_dispatch
+ def after_dispatch(env)
Rails::Subscriber.flush_all!
end