def exception_log
return unless logfile
require 'logger'
l_file = Logger.new(logfile)
e = nil
ObjectSpace.each_object {|o|
if ::Exception === o
e = o
end
}
l_file.info "*** below you find the most recent exception thrown, this will be likely (but not certainly) the exception that made the application exit abnormally ***"
l_file.error e
l_file.info "*** below you find all exception objects found 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|
if ::Exception === o
l_file.error o
end
}
l_file.close
end