lumberjack icon indicating copy to clipboard operation
lumberjack copied to clipboard

Rotate on daily based?

Open sriram275 opened this issue 5 years ago • 4 comments

Is that possible to rotate logger based on daily instead maxSize ? Since we want to rotate log file daily irrespectie of the log file size.

Thanks, Sriram

sriram275 avatar Aug 28 '19 10:08 sriram275

Daily rotation files is also an option for me independently of size.

joseluisq avatar Oct 30 '19 10:10 joseluisq

By the way, this is a duplicated of #54.

joseluisq avatar Oct 30 '19 11:10 joseluisq

You can actually make a filename like this instead of a fixed filename value:

logFile := "logs/app_name_" + time.Now().Format("01-02-2006") + ".log" log.SetOutput(&lumberjack.Logger{ Filename: logFile, MaxSize: 500, // megabytes MaxBackups: 3, MaxAge: 28, //days Compress: true, // disabled by default })

itrepablik avatar Feb 20 '20 01:02 itrepablik

a project timewriter impl daily rotate: timewriter @sriram275

longbozhan avatar Dec 08 '21 14:12 longbozhan