lib/fluent/engine.rb in fluentd-0.10.35 vs lib/fluent/engine.rb in fluentd-0.10.36

- old
+ new

@@ -130,13 +130,13 @@ end @match_cache[tag] = target @match_cache_keys << tag end target.emit(tag, es) - rescue + rescue => e if @suppress_emit_error_log_interval == 0 || now > @next_emit_error_log_time - $log.warn "emit transaction failed ", :error=>$!.to_s + $log.warn "emit transaction failed ", :error_class=>e.class, :error=>e $log.warn_backtrace # $log.debug "current next_emit_error_log_time: #{Time.at(@next_emit_error_log_time)}" @next_emit_error_log_time = Time.now.to_i + @suppress_emit_error_log_interval # $log.debug "next emit failure log suppressed" # $log.debug "next logged time is #{Time.at(@next_emit_error_log_time)}" @@ -173,12 +173,12 @@ next if events.empty? events.each {|tag,time,record| begin Engine.emit(tag, time, record) - rescue - $log.error "failed to emit fluentd's log event", :tag => tag, :event => record, :error => $! + rescue => e + $log.error "failed to emit fluentd's log event", :tag => tag, :event => record, :error_class => e.class, :error => e end } end end @@ -195,12 +195,12 @@ @default_loop = Coolio::Loop.default @default_loop.attach Coolio::TimerWatcher.new(1, true) # TODO attach async watch for thread pool @default_loop.run - rescue - $log.error "unexpected error", :error=>$!.to_s + rescue => e + $log.error "unexpected error", :error_class=>e.class, :error=>e $log.error_backtrace ensure $log.info "shutting down fluentd" shutdown if @log_emit_thread @@ -238,12 +238,12 @@ def shutdown @started.map {|s| Thread.new do begin s.shutdown - rescue - $log.warn "unexpected error while shutting down", :error=>$!.to_s + rescue => e + $log.warn "unexpected error while shutting down", :error_class=>e.class, :error=>e $log.warn_backtrace end end }.each {|t| t.join @@ -259,11 +259,11 @@ if m.is_a?(BufferedOutput) m.force_flush elsif m.is_a?(MultiOutput) flush_recursive(m.outputs) end - rescue - $log.debug "error while force flushing", :error=>$!.to_s + rescue => e + $log.debug "error while force flushing", :error_class=>e.class, :error=>e $log.debug_backtrace end } end