-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(glog): add log rotation support for short-running process #2658
Conversation
@xuyue86 The CI failed: please |
@xuyue86 你这样改动确实能解决日志文件滚动的问题,但会额外引发性能问题,因为每一次写日志都会触发滚动逻辑。我建议你不要调整异步逻辑,保留其他可能引发日志文件滚动逻辑失败的代码。 |
@xuyue86 Your changes can indeed solve the problem of log file scrolling, but it will cause additional performance problems, because every time a log is written, the scrolling logic will be triggered. |
@gqcn We have this condition "l.config.rotatedHandlerInitialized.Cas(false, true) ",I think it will only triggered the first time when calling print. |
add file pattern matching detection for log rotation and backup file limitation. backupfile limitation will working on all files matching pattern.
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #2658 +/- ##
==========================================
- Coverage 78.88% 78.84% -0.04%
==========================================
Files 631 631
Lines 51784 51790 +6
==========================================
- Hits 40848 40833 -15
- Misses 8913 8934 +21
Partials 2023 2023
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
1.add file pattern matching detection for log rotation and backup file limitation:
before this commit:
log rotation is not working on short-running process
2.backup file limitation will working on all files matching pattern:
before this commit:
access-{y-m-d}.log will generate log like:
access-2023-05-19.log
access-2023-05-18.log
the limitation only working on rotation files like "access-2023-05-19.xxxxxxxxxxxx.log" , not counting the "access-2023-05-18.xxxxxxxxxxxxx.log"