Commit 80fa5146 authored by 陈培远's avatar 陈培远

avoid unnecessary read of large log file

If w.MaxLines is not set, there is no need to calc large log file’s lines. It may takes more than 10mins to calc a 10G file.
parent e211e483
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment