From 841f09546459bf89bd6618300798a0bb0f8d731b Mon Sep 17 00:00:00 2001
From: Masahiro Nakagawa <repeatedly@gmail.com>
Date: Tue, 14 Nov 2017 01:16:55 +0900
Subject: [PATCH] Add error location to emit error logs. fix #1737

---
 lib/fluent/root_agent.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/fluent/root_agent.rb b/lib/fluent/root_agent.rb
index 3745992763..c8fea1375a 100644
--- a/lib/fluent/root_agent.rb
+++ b/lib/fluent/root_agent.rb
@@ -292,7 +292,7 @@ def find_label(label_name)
     end
 
     def emit_error_event(tag, time, record, error)
-      error_info = {error: error, tag: tag, time: time}
+      error_info = {error: error, 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