Skip to content

Commit

Permalink
Don't assume logging is properly set up when handling unexpected errors
Browse files Browse the repository at this point in the history
This can sometimes cause problems on rubies with real concurrency such
as jruby.  We may try to disconnect before the logger is defined.
  • Loading branch information
Sam Goldstein committed May 18, 2012
1 parent 7888faf commit 7cddc6c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/new_relic/agent/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ def handle_server_connection_problem(error)
# unknown state
def handle_other_error(error)
log.error "Terminating worker loop: #{error.class.name}: #{error.message}\n #{error.backtrace.join("\n ")}"
rescue # don't assume logger is set up if we're in an unknown state
warn "Terminating worker loop: #{error.class.name}: #{error.message}\n #{error.backtrace.join("\n ")}"
ensure
disconnect
end

Expand Down

0 comments on commit 7cddc6c

Please sign in to comment.