Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

按日切割和按大小切割同时打开的时候,历史Log日期错误 #21

Open
ghost opened this issue Jul 3, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Jul 3, 2018

_20180703100818

if w.MaxLines > 0 || w.MaxSize > 0 {
		for ; err == nil && num <= 999; num++ {
			fName = w.fileNameOnly + fmt.Sprintf(".%s.%03d%s", logTime.Format("2006-01-02"), num, w.suffix)//这块用的Logtime 是新一天的日期 应该用dailyOpenTime?
			_, err = os.Lstat(fName)
		}
	} else {
		fName = fmt.Sprintf("%s.%s%s", w.fileNameOnly, w.dailyOpenTime.Format("2006-01-02"), w.suffix)
		_, err = os.Lstat(fName)
		for ; err == nil && num <= 999; num++ {
			fName = w.fileNameOnly + fmt.Sprintf(".%s.%03d%s", w.dailyOpenTime.Format("2006-01-02"), num, w.suffix)
			_, err = os.Lstat(fName)
		}
	}
@ghost
Copy link
Author

ghost commented Jul 3, 2018

file {
filename = "log/gate.log"
daily = true
rotate = true
level = 3
max-lines = 0
max-size = 104857600
}

daily 和 max-size都开启,当到新一天的时候,比如2016-07-02,重命名07-01的旧日志用的新日期,把上面代码的logTime改为dailyOpenTime是否能解决?

@xujinzheng
Copy link
Member

请见 #17 这个是从beego移植过来的,但beego的作者一直未更新

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant