summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorying.yunlong <ying.yunlong@zte.com.cn>2018-08-06 09:24:57 +0800
committerying.yunlong <ying.yunlong@zte.com.cn>2018-08-06 09:24:57 +0800
commit811db069bd81d687f3d3f7e27bfad9b819e6e0db (patch)
treed2b984af896b774d03bc8142b703e451af22a796
parent612a77236f2e9d2a4bf13b968b085a2642f88ef0 (diff)
Fix log error when run vnfmgr tests in windows
Change-Id: I0a35f614f7ad3836f1ecb6fcb6898c3712746166 Issue-ID: VFC-1014 Signed-off-by: ying.yunlong <ying.yunlong@zte.com.cn>
-rw-r--r--mgr/mgr/settings.py75
1 files changed, 36 insertions, 39 deletions
diff --git a/mgr/mgr/settings.py b/mgr/mgr/settings.py
index 5328a51..961c4fb 100644
--- a/mgr/mgr/settings.py
+++ b/mgr/mgr/settings.py
@@ -14,6 +14,7 @@
import os
import sys
+import platform
import redisco
@@ -123,48 +124,44 @@ TIME_ZONE = 'UTC'
# https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/'
-#
-# LOGGING = {
-# 'version': 1,
-# 'disable_existing_loggers': True,
-# 'formatters': {
-# 'standard': {
-# 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s',
-# },
-# },
-# 'filters': {
-# },
-# 'handlers': {
-# 'mgr_handler': {
-# 'level': 'DEBUG',
-# 'class': 'logging.handlers.RotatingFileHandler',
-# 'filename': os.path.join(BASE_DIR, 'logs/runtime_mgr.log'),
-# 'formatter': 'standard',
-# 'maxBytes': 1024 * 1024 * 50,
-# 'backupCount': 5,
-# },
-# },
-#
-# 'loggers': {
-# 'mgr': {
-# 'handlers': ['mgr_handler'],
-# 'level': 'DEBUG',
-# 'propagate': False
-# },
-# }
-# }
-
-LOGGING_CONFIG = None
-# yaml configuration of logging
-LOGGING_FILE = os.path.join(BASE_DIR, 'mgr/log.yml')
-if 'test' in sys.argv:
- os.system('sed -i "s|/var/log/onap/vfc/gvnfm-vnfmgr|/tmp|" %s' % LOGGING_FILE)
-config.yamlConfig(filepath=LOGGING_FILE, watchDog=True)
+if platform.system() == 'Windows' or 'test' in sys.argv:
+ LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': True,
+ 'formatters': {
+ 'standard': {
+ 'format': '%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s',
+ },
+ },
+ 'filters': {
+ },
+ 'handlers': {
+ 'mgr_handler': {
+ 'level': 'DEBUG',
+ 'class': 'logging.handlers.RotatingFileHandler',
+ 'filename': os.path.join(BASE_DIR, 'logs/runtime_mgr.log'),
+ 'formatter': 'standard',
+ 'maxBytes': 1024 * 1024 * 50,
+ 'backupCount': 5,
+ },
+ },
+
+ 'loggers': {
+ 'mgr': {
+ 'handlers': ['mgr_handler'],
+ 'level': 'DEBUG',
+ 'propagate': False
+ },
+ }
+ }
+else:
+ LOGGING_CONFIG = None
+ LOGGING_FILE = os.path.join(BASE_DIR, 'mgr/log.yml')
+ config.yamlConfig(filepath=LOGGING_FILE, watchDog=True)
-if 'test' in sys.argv:
- os.system('sed -i "s|/tmp|/var/log/onap/vfc/gvnfm-vnfmgr|" %s' % LOGGING_FILE)
+if 'test' in sys.argv:
from mgr.pub.config import config
config.REG_TO_MSB_WHEN_START = False
DATABASES = {}