Silence Flask access logs and retain PM2 logs for 3 days.

Stop werkzeug request spam into PM2 error files, truncate oversized logs, and install daily logrotate with 3-day retention.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-15 07:53:19 +08:00
parent 8ecc70a61c
commit 1e765f4b2b
7 changed files with 108 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
"""silence_werkzeug_access_log 烟雾测试."""
import logging
import unittest
from lib.common.flask_access_log_lib import silence_werkzeug_access_log
class TestSilenceAccessLog(unittest.TestCase):
def test_sets_warning_level(self):
log = logging.getLogger("werkzeug")
log.setLevel(logging.INFO)
silence_werkzeug_access_log()
self.assertGreaterEqual(log.level, logging.WARNING)
if __name__ == "__main__":
unittest.main()