lib/logstasher/log_subscriber.rb in logstasher-0.6.1 vs lib/logstasher/log_subscriber.rb in logstasher-0.6.2
- old
+ new
@@ -78,10 +78,15 @@
# Monkey patching to enable exception logging
def extract_exception(payload)
if payload[:exception]
exception, message = payload[:exception]
status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception)
- message = "#{exception}\n#{message}\n#{($!.backtrace.join("\n"))}"
+ if LogStasher.backtrace
+ backtrace = $!.backtrace.join("\n")
+ else
+ backtrace = $!.backtrace.first
+ end
+ message = "#{exception}\n#{message}\n#{backtrace}"
{ :status => status, :error => message }
else
{}
end
end