go-logger icon indicating copy to clipboard operation
go-logger copied to clipboard

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

Open sullfu opened this issue 4 years ago • 2 comments

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 avatar Apr 09 '20 10:04 sullfu

我也遇到这个问题了

tonny-xu avatar Mar 16 '22 02:03 tonny-xu

我也遇到这个问题了

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

tonny-xu avatar Mar 21 '22 02:03 tonny-xu