diff options
author | Jay Pignata <john.pignata@gmail.com> | 2009-08-11 00:56:46 -0400 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-08-15 16:51:03 -0700 |
commit | 679128da58636f3ec96e24fcb7daac24666b2dad (patch) | |
tree | 51d16ff1b0476b6fbbb2bb453639a846adc9a894 /actionpack/lib/action_dispatch | |
parent | 911acc10de483e0d7a9e6b3c475aeaecad49bfc5 (diff) | |
download | rails-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/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/params_parser.rb | 6 |
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 |