aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJay Pignata <john.pignata@gmail.com>2009-08-11 00:56:46 -0400
committerJeremy Kemper <jeremy@bitsweat.net>2009-08-15 16:51:03 -0700
commit679128da58636f3ec96e24fcb7daac24666b2dad (patch)
tree51d16ff1b0476b6fbbb2bb453639a846adc9a894 /actionpack/lib
parent911acc10de483e0d7a9e6b3c475aeaecad49bfc5 (diff)
downloadrails-679128da58636f3ec96e24fcb7daac24666b2dad.tar.gz
rails-679128da58636f3ec96e24fcb7daac24666b2dad.tar.bz2
rails-679128da58636f3ec96e24fcb7daac24666b2dad.zip
Adding a call to logger from params_parser to give detailed debug information when invalid xml or json is posted
[#2481 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/middleware/params_parser.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb
index e83cf9236b..ff2b2fe74b 100644
--- a/actionpack/lib/action_dispatch/middleware/params_parser.rb
+++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb
@@ -47,6 +47,8 @@ module ActionDispatch
false
end
rescue Exception => e # YAML, XML or Ruby code block errors
+ logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}"
+
raise
{ "body" => request.raw_post,
"content_type" => request.content_type,
@@ -67,5 +69,9 @@ module ActionDispatch
nil
end
+
+ def logger
+ defined?(Rails.logger) ? Rails.logger : Logger.new($stderr)
+ end
end
end