diff --git a/logger/rotater/global.go b/logger/rotater/global.go index 95a4778..d9b6a85 100644 --- a/logger/rotater/global.go +++ b/logger/rotater/global.go @@ -5,6 +5,7 @@ import ( "path" "log" "amuz.es/src/infra/goutils/logger" + "github.com/lestrrat-go/file-rotatelogs" ) var loggers RotateSyncerSet @@ -21,7 +22,8 @@ func NewLogWriter(FileName string, logDir string, options ...Option) (logger.Rot logpath = path.Join(logDir, FileName) } log.Println(" Attention!! log writes to ", logpath) - if logWriter, err := NewRotater(logpath, options...); err != nil { + options=append(options,rotatelogs.WithLinkName(logpath)) + if logWriter, err := NewRotater(logpath+".%Y%M%D", options...); err != nil { return nil, err } else { loggers.Store(logWriter)