Skip to content

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

Open
@sullfu

Description

@sullfu

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号的文件中。

Activity

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

tonny-xu commented on Mar 16, 2022

@tonny-xu

我也遇到这个问题了

tonny-xu

tonny-xu commented on Mar 21, 2022

@tonny-xu

我也遇到这个问题了

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sullfu@tonny-xu

        Issue actions

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