优化:降低访问日志噪声并增加日志文件轮转

This commit is contained in:
yml2213
2026-08-30 16:59:11 +08:00
parent 6ca54e468e
commit 25b89bb503
20 changed files with 2334 additions and 4 deletions
@@ -0,0 +1,14 @@
Log volume optimization diff summary
1. apps/backend/src/middleware/access-log.ts
- Successful GET/HEAD responses (2xx/3xx) now use DEBUG.
- Writes and all 4xx/5xx responses remain INFO.
2. apps/backend/src/utils/logger.ts
- Appends rotate at LOG_MAX_FILE_SIZE_MB (default 20MB).
- Keeps LOG_MAX_FILES (default 5) files per channel/date.
- Rotated files are included in retention cleanup.
3. Configuration/docs/tests
- Added LOG_MAX_FILE_SIZE_MB and LOG_MAX_FILES to env overrides,
Compose files, examples, runtime types, backend README, and tests.