From e73915c76e788f35cbd54d0db159e4d86f59b02d Mon Sep 17 00:00:00 2001 From: uu59 Date: Thu, 3 Jul 2014 15:00:16 +0900 Subject: [PATCH] Fix error when log file is not created yet --- app/models/fluentd/agent/local_common.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/models/fluentd/agent/local_common.rb b/app/models/fluentd/agent/local_common.rb index 026193f..a611067 100644 --- a/app/models/fluentd/agent/local_common.rb +++ b/app/models/fluentd/agent/local_common.rb @@ -11,6 +11,7 @@ class Fluentd end def log + return "" unless File.exists?(log_file) File.read(log_file) # TODO: large log file end @@ -32,6 +33,8 @@ class Fluentd end def log_tail(limit = nil) + return [] unless File.exists?(log_file) + limit = limit.to_i rescue 0 limit = limit.zero? ? Settings.default_log_tail_count : limit io = File.open(log_file)