Merge pull request #2920 from chenpeiyuan/develop

avoid unnecessary read of large log file
This commit is contained in:
astaxie 2017-11-07 09:35:09 -06:00 committed by GitHub
commit 3b829504f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -182,7 +182,7 @@ func (w *fileLogWriter) initFd() error {
if w.Daily {
go w.dailyRotate(w.dailyOpenTime)
}
if fInfo.Size() > 0 {
if fInfo.Size() > 0 && w.MaxLines > 0 {
count, err := w.lines()
if err != nil {
return err