public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Use fully-qualified controller name when logging. [#600 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Ripta Pasay (author)
Sat Jul 12 15:54:24 -0700 2008
lifo (committer)
Wed Jul 16 17:33:44 -0700 2008
commit  f7fdbae770275ccbc277c42287b9783cb00fa9fa
tree    e24232610d6261421a7a1f9e353c817f1f5b7b30
parent  396f9df8916b71f83aad8d56559cf55fc8501679
...
1155
1156
1157
1158
 
1159
1160
1161
...
1155
1156
1157
 
1158
1159
1160
1161
0
@@ -1155,7 +1155,7 @@ module ActionController #:nodoc:
0
 
0
       def log_processing
0
         if logger && logger.info?
0
- logger.info "\n\nProcessing #{controller_class_name}\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]"
0
+ logger.info "\n\nProcessing #{self.class.name}\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]"
0
           logger.info " Session ID: #{@_session.session_id}" if @_session and @_session.respond_to?(:session_id)
0
           logger.info " Parameters: #{respond_to?(:filter_parameters) ? filter_parameters(params).inspect : params.inspect}"
0
         end
...
7
8
9
 
10
11
12
...
105
106
107
 
 
 
 
 
 
 
 
 
 
 
 
108
109
110
...
142
143
144
 
 
 
 
 
 
 
145
146
147
...
7
8
9
10
11
12
13
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
155
156
157
158
159
160
161
162
163
164
165
166
167
0
@@ -7,6 +7,7 @@ module Submodule
0
   end
0
   class ContainedNonEmptyController < ActionController::Base
0
     def public_action
0
+ render :nothing => true
0
     end
0
     
0
     hide_action :hidden_action
0
@@ -105,6 +106,18 @@ end
0
 
0
 
0
 class PerformActionTest < Test::Unit::TestCase
0
+ class MockLogger
0
+ attr_reader :logged
0
+
0
+ def initialize
0
+ @logged = []
0
+ end
0
+
0
+ def method_missing(method, *args)
0
+ @logged << args.first
0
+ end
0
+ end
0
+
0
   def use_controller(controller_class)
0
     @controller = controller_class.new
0
 
0
@@ -142,6 +155,13 @@ class PerformActionTest < Test::Unit::TestCase
0
     get :another_hidden_action
0
     assert_response 404
0
   end
0
+
0
+ def test_namespaced_action_should_log_module_name
0
+ use_controller Submodule::ContainedNonEmptyController
0
+ @controller.logger = MockLogger.new
0
+ get :public_action
0
+ assert_match /Processing\sSubmodule::ContainedNonEmptyController#public_action/, @controller.logger.logged[1]
0
+ end
0
 end
0
 
0
 class DefaultUrlOptionsTest < Test::Unit::TestCase

Comments

    No one has commented yet.