Browse Source

修改欧洲日志配置

locky 1 year ago
parent
commit
ce44581292
1 changed files with 17 additions and 4 deletions
  1. 17 4
      AnsjerPush/eur_config/eur_formal_settings.py

+ 17 - 4
AnsjerPush/eur_config/eur_formal_settings.py

@@ -165,7 +165,6 @@ LOGGING = {
     'disable_existing_loggers': True,
     'formatters': {
         'error_format': {
-            # 'format': '{"asctime":"%(asctime)s","thread":"%(threadName)s:%(thread)d","errorline":"%(lineno)d","errorlevel":"%(levelname)s","errorcontent":"%(message)s"}'
             'format': '%(asctime)s %(threadName)s %(thread)d %(lineno)d %(levelname)s %(message)s'
         },
         'standard': {
@@ -183,7 +182,7 @@ LOGGING = {
         'default': {
             'level': 'ERROR',
             'class': 'logging.handlers.RotatingFileHandler',
-            'filename': BASE_DIR + '/static/log/error.log',
+            'filename': BASE_DIR + '/static/log/error/error.log',
             'maxBytes': 1024 * 1024 * 5,  # 5 MB
             'backupCount': 5,
             'formatter': 'error_format',
@@ -195,18 +194,27 @@ LOGGING = {
         },
         'info': {
             'level': 'INFO',
-            'class': 'logging.handlers.RotatingFileHandler',
+            'class': 'logging.handlers.TimedRotatingFileHandler',
             'filename': BASE_DIR + '/static/log/info/info.log',
             'maxBytes': 1024 * 1024 * 300,  # 300M
             'backupCount': 30,
             'formatter': 'standard',
             'encoding': 'utf-8',
         },
+        'time': {
+            'level': 'INFO',
+            'class': 'logging.handlers.TimedRotatingFileHandler',
+            'filename': BASE_DIR + '/static/log/time/info.log',
+            'maxBytes': 1024 * 1024 * 300,  # 300M
+            'backupCount': 30,
+            'when': 'D',
+            'formatter': 'standard',
+            'encoding': 'utf-8',
+        },
     },
     'loggers': {
         'django': {
             'handlers': ['default', 'console'],
-            # 'handlers': ['mail_admins','default','console'],
             'level': 'ERROR',
             'propagate': False
         },
@@ -215,6 +223,11 @@ LOGGING = {
             'handlers': ['info'],
             'level': 'INFO',
             'propagate': False
+        },
+        'time': {
+            'handlers': ['time'],
+            'level': 'INFO',
+            'propagate': False
         }
     }
 }