Skip to content
Browse files

Use fully-qualified controller name when logging. [#600 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
1 parent 50c73c2 commit 6fbd6c0a009e4848b9cd2e0a055b8ecdb867049f Ripta Pasay committed with tarmo Jul 12, 2008
Showing with 21 additions and 1 deletion.
  1. +1 −1 actionpack/lib/action_controller/base.rb
  2. +20 −0 actionpack/test/controller/base_test.rb
View
2 actionpack/lib/action_controller/base.rb
@@ -1150,7 +1150,7 @@ def initialize_current_url
def log_processing
if logger && logger.info?
- logger.info "\n\nProcessing #{controller_class_name}\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]"
+ logger.info "\n\nProcessing #{self.class.name}\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]"
logger.info " Session ID: #{@_session.session_id}" if @_session and @_session.respond_to?(:session_id)
logger.info " Parameters: #{respond_to?(:filter_parameters) ? filter_parameters(params).inspect : params.inspect}"
end
View
20 actionpack/test/controller/base_test.rb
@@ -7,6 +7,7 @@ class ContainedEmptyController < ActionController::Base
end
class ContainedNonEmptyController < ActionController::Base
def public_action
+ render :nothing => true
end
hide_action :hidden_action
@@ -105,6 +106,18 @@ def hide_mocha_methods_from_controller(controller)
class PerformActionTest < Test::Unit::TestCase
+ class MockLogger
+ attr_reader :logged
+
+ def initialize
+ @logged = []
+ end
+
+ def method_missing(method, *args)
+ @logged << args.first
+ end
+ end
+
def use_controller(controller_class)
@controller = controller_class.new
@@ -142,6 +155,13 @@ def test_get_on_hidden_should_fail
get :another_hidden_action
assert_response 404
end
+
+ def test_namespaced_action_should_log_module_name
+ use_controller Submodule::ContainedNonEmptyController
+ @controller.logger = MockLogger.new
+ get :public_action
+ assert_match /Processing\sSubmodule::ContainedNonEmptyController#public_action/, @controller.logger.logged[1]
+ end
end
class DefaultUrlOptionsTest < Test::Unit::TestCase

0 comments on commit 6fbd6c0

Please sign in to comment.
Something went wrong with that request. Please try again.