go-zero
go-zero copied to clipboard
KeepDays doesn't work on windows
Windows 系统下logx设置了KeepDays无法正常删除过期日志,
问题代码 core/logx/writer.go:133
accessFile := path.Join(c.Path, accessFilename) 拿到的 目录地址为 ”logs/access.log“
后续删除时的判断:
core/logx/rotatelogger.go:126
for _, file := range files {
if file < boundaryFile {
outdates = append(outdates, file)
}
}
此时 file为 ”logs/access***.log“ ,boundaryFile 为“logs\access***.log”,因分隔符不对,file < boundaryFile 判断不准,导致windows系统下不会删除过期的日志文件。同理,Rotation 为size时 rename文件也会有问题。
Are you running your services on windows for production?
Yes, I used the go-zero to write some small go programs that work on Windows
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.