aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Cochran <sj26@sj26.com>2018-11-28 16:45:31 +1100
committerSamuel Cochran <sj26@sj26.com>2018-11-28 20:10:00 +1100
commit0b2c49aa4dad73d2af098bbbd545c05ed2ace3cd (patch)
tree66fd2b45437c07a5391c55f6e73b00cc753eec65
parentac721c855203ac7570545c0e85fe086f8e94d94a (diff)
downloadrails-0b2c49aa4dad73d2af098bbbd545c05ed2ace3cd.tar.gz
rails-0b2c49aa4dad73d2af098bbbd545c05ed2ace3cd.tar.bz2
rails-0b2c49aa4dad73d2af098bbbd545c05ed2ace3cd.zip
Log exceptions atomically
When distributed over multiple logger calls the lines can become intermixed with other log statements. Combining them into a single logger call makes sure they always get logged together.
-rw-r--r--actionpack/lib/action_dispatch/middleware/debug_exceptions.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
index 5f5fdbc66a..61e7e73a68 100644
--- a/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
+++ b/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb
@@ -180,11 +180,14 @@ module ActionDispatch
trace = wrapper.framework_trace if trace.empty?
ActiveSupport::Deprecation.silence do
- logger.fatal " "
- logger.fatal "#{exception.class} (#{exception.message}):"
- log_array logger, exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
- logger.fatal " "
- log_array logger, trace
+ message = []
+ message << " "
+ message << "#{exception.class} (#{exception.message}):"
+ message += exception.annoted_source_code if exception.respond_to?(:annoted_source_code)
+ message << " "
+ message += trace
+
+ log_array(logger, message)
end
end