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

[Bug] RotateTime.level() #121

Open
ly020044 opened this issue Sep 16, 2023 · 2 comments
Open

[Bug] RotateTime.level() #121

ly020044 opened this issue Sep 16, 2023 · 2 comments
Assignees

Comments

@ly020044
Copy link

System (please complete the following information):

  • OS: macOS
  • GO Version: 1.21.0
  • Pkg Version: 0.5.4

Describe the bug

当我配置按日期的方式来滚动日志时,当大于 1 天时只能按 1 天来滚动日志。

To Reproduce

seconds := 604800 // 7天
handler.NewTimeRotateFileHandler(
		logFile,
		rotatefile.RotateTime(seconds),
		handler.WithLogLevels(parseLevels(log.level)),
		handler.WithBuffSize(log.bufferSize),
		handler.WithBackupNum(log.maxBackups),
		handler.WithCompress(log.compress),
		handler.WithFilePerm(log.filePerm),

请查看一下这个方法 RotateTime.level

@inhere inhere added the bug Something isn't working label Sep 16, 2023
@inhere
Copy link
Member

inhere commented Nov 30, 2023

看了代码,感觉没问题啊。第一次是按当天的结束时间开始切,下一次是在 curTime + checkInterval(= 604800) 时切割处理。

@inhere inhere added unconfirmed and removed bug Something isn't working labels Jan 23, 2024
@iredmail
Copy link

iredmail commented Mar 4, 2024

实际生产环境:设置了备份间隔为1星期,再加上 rotate backup 为 20(保留20个 rotate 之后的log文件),但实际有且只有一个 rotate 后的 log 文件。

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

No branches or pull requests

3 participants