fix bug: logs lost using ConcurrentRotatingFileHandler

Brightcells 8 years ago
parent
commit
2eb44593ee
1 changed files with 5 additions and 3 deletions
  1. 5 3
      pai2/settings.py

+ 5 - 3
pai2/settings.py

@@ -15,6 +15,8 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
15 15
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16 16
 import os
17 17
 
18
+from cloghandler import ConcurrentRotatingFileHandler
19
+
18 20
 
19 21
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
20 22
 PROJ_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
@@ -207,9 +209,9 @@ LOGGING = {
207 209
     'handlers': {
208 210
         'logit': {
209 211
             'level': 'DEBUG',
210
-            'class': 'logging.handlers.TimedRotatingFileHandler',
211
-            'filename': '/tmp/logit.log',
212
-            'when': 'midnight',
212
+            'class': 'logging.handlers.ConcurrentRotatingFileHandler',
213
+            'filename': '/tmp/pai2.logit.log',
214
+            'maxBytes': 15728640,  # 1024 * 1024 * 15B = 15MB
213 215
             'backupCount': 10,
214 216
             'formatter': 'verbose',
215 217
         },