瀏覽代碼

hide more 404 and 304 errors from daphne logs

Nick Sweeting 1 年之前
父節點
當前提交
f6ca48835a
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 1 1
      archivebox/core/settings.py
  2. 4 0
      archivebox/monkey_patches.py

+ 1 - 1
archivebox/core/settings.py

@@ -522,7 +522,7 @@ LOGGING = {
         "django.request": {  # only logs 4xx and 5xx errors
             "propagate": False,
             "handlers": ["default", "logfile"],
-            "level": "INFO",
+            "level": "ERROR",
             "filters": ["noisyrequestsfilter"],
         },
         "django.db.backends": {

+ 4 - 0
archivebox/monkey_patches.py

@@ -37,6 +37,10 @@ class ModifiedAccessLogGenerator(access.AccessLogGenerator):
             return
         if request.endswith("/favicon.ico") or request.endswith("/robots.txt") or request.endswith("/screenshot.png"):
             return
+        if request.endswith('.css') or request.endswith('.js') or request.endswith('.woff') or request.endswith('.ttf'):
+            return
+        if str(status) in ('404', '304'):
+            return
         
         # clean up the log format to mostly match the same format as django.conf.settings.LOGGING rich formats
         self.stream.write(