From b28581a463dbefccd8bea73461a2958874afbebe Mon Sep 17 00:00:00 2001 From: JessonChan Date: Fri, 6 May 2016 12:11:14 +0800 Subject: [PATCH] make daily rotate --- logs/file.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/logs/file.go b/logs/file.go index 42a1cb46..b87664bd 100644 --- a/logs/file.go +++ b/logs/file.go @@ -167,6 +167,9 @@ func (w *fileLogWriter) initFd() error { w.dailyOpenTime = time.Now() w.dailyOpenDate = w.dailyOpenTime.Day() w.maxLinesCurLines = 0 + if w.Daily { + go w.dailyRotate(w.dailyOpenTime) + } if fInfo.Size() > 0 { count, err := w.lines() if err != nil { @@ -174,9 +177,6 @@ func (w *fileLogWriter) initFd() error { } w.maxLinesCurLines = count } - if w.Daily { - go w.dailyRotate(w.dailyOpenTime) - } return nil }