natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.81k stars 593 forks source link

fix:rotate with localtime #197

Open wangkunn opened 10 months ago

wangkunn commented 10 months ago

This PR fixes a time zone issue regarding log rotation. When calculating whether an old log file has reached rotation time, the time zone is not taken into account for the processing of timestamps in log file names, even if localtime is set to true. This may cause the log rotation time to differ from MaxAge.

zhangyial commented 4 months ago

I'm running into this issue as well. If the time of the parsing file does not take into account the current local time zone, the timestamp and maxAge of the comparison file are abnormal。 Hopefully, this request will be merged into the trunk branch。 image