Skip to content

Commit

Permalink
Merge pull request #1746 from fluent/add-error-location-to-emit-error
Browse files Browse the repository at this point in the history
Add error location to emit error logs. fix #1737
  • Loading branch information
repeatedly committed Nov 14, 2017
1 parent 3be7587 commit 997ac59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/fluent/root_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def find_label(label_name)
end

def emit_error_event(tag, time, record, error)
error_info = {error_class: error.class, error: error.to_s, tag: tag, time: time}
error_info = {error_class: error.class, error: error.to_s, location: (error.backtrace ? error.backtrace.first : nil), tag: tag, time: time}
if @error_collector
# A record is not included in the logs because <@ERROR> handles it. This warn is for the notification
log.warn "send an error event to @ERROR:", error_info
Expand All @@ -189,7 +189,7 @@ def emit_error_event(tag, time, record, error)
end

def handle_emits_error(tag, es, error)
error_info = {error_class: error.class, error: error.to_s, tag: tag}
error_info = {error_class: error.class, error: error.to_s, location: (error.backtrace ? error.backtrace.first : nil), tag: tag}
if @error_collector
log.warn "send an error event stream to @ERROR:", error_info
@error_collector.emit_stream(tag, es)
Expand Down Expand Up @@ -218,7 +218,7 @@ def initialize(root_agent)
end

def emit_error_event(tag, time, record, error)
error_info = {error_class: error.class, error: error.to_s, tag: tag, time: time, record: record}
error_info = {error_class: error.class, error: error.to_s, location: (error.backtrace ? error.backtrace.first : nil), tag: tag, time: time, record: record}
log.warn "dump an error event in @ERROR:", error_info
end

Expand Down

0 comments on commit 997ac59

Please sign in to comment.