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

日志文件设置最大行数并按照year切割后,日志会输出到之前按照日期切割出的文件中 #5

Open
sullfu opened this issue Apr 9, 2020 · 2 comments

Comments

@sullfu
Copy link

sullfu commented Apr 9, 2020

fileConfig := &go_logger.FileConfig{ LevelFileName: map[int]string{ Logger.LoggerLevel("error"): fmt.Sprintf("%s/file.log", logDir), Logger.LoggerLevel("info"): fmt.Sprintf("%s/file.log", logDir), Logger.LoggerLevel("debug"): fmt.Sprintf("%s/file.log", logDir), }, MaxSize: 0, MaxLine: 1000000, DateSlice: "y", JsonFormat: false, Format: logFormat, }
设置如上, 发现一个奇怪的问题4月9号的日志输出到了切割出的4月2号的文件中。

@sullfu sullfu changed the title 日志文件设置最大行数并按照year切割后,日志会输出到之前的日期的文件中 日志文件设置最大行数并按照year切割后,日志会输出到之前按照日期切割出的文件中 Apr 9, 2020
@tonny-xu
Copy link

我也遇到这个问题了

@tonny-xu
Copy link

我也遇到这个问题了

看了代码,发现是理解错了。
日志一直往初始化指定的文件写,当指定的时间间隔到了时,会把该文件中的所有内容切换到新的文件中,然后清空初始化指定的文件,继续往里头写。

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

2 participants