Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
Only write out the backtrace if we died from an Exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbowes committed Oct 20, 2011
1 parent d55fb5f commit 7ae78cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/safely/backtrace.rb
Expand Up @@ -16,6 +16,7 @@ def safe_shutdown!


def log_exceptions def log_exceptions
return unless @enabled && self.trace_directory && File.directory?( self.trace_directory ) return unless @enabled && self.trace_directory && File.directory?( self.trace_directory )
return if (last_exception = $!).nil?


require 'logger' require 'logger'


Expand All @@ -24,7 +25,7 @@ def log_exceptions


# Log the last exception # Log the last exception
trace_log.info "*** Below you'll find the most recent exception thrown, this will likely (but not certainly) be the exception that made #{DaemonKit.configuration.daemon_name} exit abnormally ***" trace_log.info "*** Below you'll find the most recent exception thrown, this will likely (but not certainly) be the exception that made #{DaemonKit.configuration.daemon_name} exit abnormally ***"
trace_log.error $! trace_log.error last_exception


trace_log.info "*** Below you'll find all the exception objects in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions ***" trace_log.info "*** Below you'll find all the exception objects in memory, some of them may have been thrown in your application, others may just be in memory because they are standard exceptions ***"
ObjectSpace.each_object {|o| ObjectSpace.each_object {|o|
Expand Down

0 comments on commit 7ae78cc

Please sign in to comment.