Module: Unicorn
- Defined in:
- lib/unicorn_logstash_patch.rb
Overview
See github.com/defunkt/unicorn/commit/5f478f5a9a58f72c0a844258b8ee614bf24ea9f7 Unicorn originally logs backtrace line by line with ‘exc.backtrace.each { |line| logger.error(line) }`. However, that means we get a separate logstash message for each backtrace which isn’t what we want. The monkey patch here overrides Unicorn’s logging of error so that we log the error and backtrace in a single message.
Class Method Summary collapse
Class Method Details
.log_error(logger, prefix, exc) ⇒ Object
9 10 11 12 13 |
# File 'lib/unicorn_logstash_patch.rb', line 9 def self.log_error(logger, prefix, exc) = exc. = .dump if /[[:cntrl:]]/ =~ logger.error "#{prefix}: #{} (#{exc.class})\n#{exc.backtrace.join("\n")}" end |