1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 22:50:50 +00:00

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.
This commit is contained in:
陈培远 2017-11-07 22:58:39 +08:00
parent e211e4839c
commit 80fa51468c

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