You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kane-MacBook:file-rotatelogs zhangkai$ ls -l /tmp/logs/
total 8
-rw-r--r-- 1 kane wheel 1070 8 24 23:05 access_log
kane-MacBook:file-rotatelogs zhangkai$ ls -l /tmp/logs/
total 8
-rw-r--r-- 1 kane wheel 1106 8 24 23:05 access_log
kane-MacBook:file-rotatelogs zhangkai$ ls -l /tmp/logs/
total 8
-rw-r--r-- 1 kane wheel 1142 8 24 23:05 access_log
kane-MacBook:file-rotatelogs zhangkai$ ls -l /tmp/logs/
total 8
-rw-r--r-- 1 kane wheel 1178 8 24 23:05 access_log
kane-MacBook:file-rotatelogs zhangkai$ ls -l /tmp/logs/
total 8
-rw-r--r-- 1 kane wheel 1394 8 24 23:05 access_log
Improvement
A large number of logs will be output only under abnormal circumstances, but the logs cannot be stuck.
You can set “WithRotationTime(time.Second)” to avoid problem. However, there are very few historical logs under normal circumstances Fix the log output is stuck in the ninth
https://github.com/lestrrat-go/file-rotatelogs was archived,and there are some small defects.
lestrrat-go/file-rotatelogs defects
No longer output log, when too much log output rotated by size
You can use "log" or "logrus" test
The log output is stuck in the ninth, expected to be the 1000th
ls -l /tmp/logs/ total 24 lrwxr-xr-x 1 kane wheel 26 8 22 15:33 access_log -> access_log.202108220000.10 -rw-r--r-- 1 kane wheel 35 8 22 15:33 access_log.202108220000.7 -rw-r--r-- 1 kane wheel 35 8 22 15:33 access_log.202108220000.8 -rw-r--r-- 1 kane wheel 35 8 22 15:33 access_log.202108220000.9 cat /tmp/logs/access_log.202108220000.9 2021/08/22 15:33:04 Test content 9 cat /tmp/logs/access_log cat: /tmp/logs/access_log: No such file or directory cat /tmp/logs/access_log.202108220000.10 cat: /tmp/logs/access_log.202108220000.10: No such file or directory
The log file name is ambiguous
You expect the log name to be accurate to minutes
But it's actually accurate to days,because the "rotationTime" is 1 day by default
lrwxr-xr-x 1 kane wheel 26 8 22 15:33 access_log -> access_log.202108220000.10
RotationTime doesn't work
“%Y%m%d%H%M” accurate to minutes,“rotatelogs.WithRotationTime(time.Second)” accurate to seconds invalid
Result accurate to minutes
ls -l /tmp/logs/ total 24 lrwxr-xr-x 1 kane wheel 23 8 24 22:29 access_log -> access_log.202108242229 -rw-r--r-- 1 kane wheel 2160 8 24 22:27 access_log.202108242227 -rw-r--r-- 1 kane wheel 2161 8 24 22:28 access_log.202108242228 -rw-r--r-- 1 kane wheel 1887 8 24 22:29 access_log.202108242229
No pattern no rotationTime
"/tmp/logs/access_log.%Y%m%d%H%M" -> "/tmp/logs/access_log"
Improvement
A large number of logs will be output only under abnormal circumstances, but the logs cannot be stuck.
You can set “WithRotationTime(time.Second)” to avoid problem. However, there are very few historical logs under normal circumstances
Fix the log output is stuck in the ninth
RotationTime determined according to the pattern
The text was updated successfully, but these errors were encountered: