优化:降低访问日志噪声并增加日志文件轮转
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
Log volume optimization verification
|
||||
|
||||
Changed branch/fields:
|
||||
- access log level: successful GET/HEAD 2xx/3xx -> DEBUG; writes and 4xx/5xx -> INFO
|
||||
- logging.maxFileSizeMb / LOG_MAX_FILE_SIZE_MB: default 20
|
||||
- logging.maxFiles / LOG_MAX_FILES: default 5
|
||||
- rotated files use app-YYYY-MM-DD.N.log and participate in retention cleanup
|
||||
|
||||
Source evidence:
|
||||
- Input log: /Users/yml/Downloads/logs/app-2026-08-29.log
|
||||
- Baseline: 2,080,480 lines, 767,799,564 bytes (732MB)
|
||||
- Access logs: 1,412,784 lines; successful access logs: 1,406,234 lines / 727,296,842 bytes
|
||||
- Largest paths: /api/v1/files/object 555,995; /api/v1/worker/hall/orders 446,763
|
||||
- Applying the new GET/HEAD success filter to this sample would skip 1,354,940 lines / 702,650,714 bytes, a simulated 91.51% reduction.
|
||||
|
||||
Artifacts:
|
||||
- MODIFIED_FILE: /Users/yml/codes/order_site/log-optimization-artifacts/MODIFIED_FILE.ts
|
||||
- DIFF_FILE: /Users/yml/codes/order_site/log-optimization-artifacts/DIFF_FILE.patch
|
||||
- VERIFICATION.txt: /Users/yml/codes/order_site/log-optimization-artifacts/VERIFICATION.txt
|
||||
- ROLLBACK.sh: /Users/yml/codes/order_site/log-optimization-artifacts/ROLLBACK.sh
|
||||
|
||||
BASELINE
|
||||
Command: git show HEAD:apps/backend/src/utils/logger.ts > log-optimization-artifacts/BASELINE_FILE.ts
|
||||
Input: HEAD logger source before this change
|
||||
Literal result: SHA-256 b197508d56c00362001ea58f4cdcff465d396c3d1a1127f53328dd791a8bdb57; exit status 0
|
||||
|
||||
MODIFIED
|
||||
Command: node --import tsx --test src/middleware/access-log.test.ts src/utils/logger.test.ts src/config/env-overrides.test.ts src/config/runtime-validation.test.ts
|
||||
Input: modified backend logger/access/config sources
|
||||
Literal result: tests 28; pass 28; fail 0; skipped 0; exit status 0
|
||||
|
||||
Command: npm run lint:check && npm run build
|
||||
Input: modified backend source tree
|
||||
Literal result: ESLint passed; TypeScript build completed; exit status 0
|
||||
|
||||
Command: npm run check
|
||||
Input: modified backend source tree
|
||||
Literal result: format, SQL guard, lint, typecheck passed; tests 377; pass 374; fail 1; skipped 2; existing failure at src/repositories/worker-platform-repo.test.ts:115 (unrelated blank-search SQL assertion); exit status 1
|
||||
|
||||
ROLLBACK
|
||||
Command: log-optimization-artifacts/ROLLBACK.sh log-optimization-artifacts/rollback-copy
|
||||
Input: independent copy containing MODIFIED_FILE.ts
|
||||
Literal result: restored logger baseline in log-optimization-artifacts/rollback-copy; restored SHA-256 b197508d56c00362001ea58f4cdcff465d396c3d1a1127f53328dd791a8bdb57; exit status 0
|
||||
Restored behavior/status: rollback-copy logger matches baseline; working source remains modified.
|
||||
Reference in New Issue
Block a user