Remove dependency on onaplogging in vnfmgr
[vfc/gvnfm/vnfmgr.git] / mgr / mgr / settings.py
index 3de34bf..c64a219 100644 (file)
@@ -21,8 +21,8 @@ import mgr.pub.redisco
 from mgr.pub.config.config import REDIS_HOST, REDIS_PORT, REDIS_PASSWD
 from mgr.pub.config.config import DB_NAME, DB_IP, DB_USER, DB_PASSWD, DB_PORT
 from logging import config
-from onaplogging import monkey
-monkey.patch_all()
+
+import yaml
 
 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -61,7 +61,6 @@ MIDDLEWARE = [
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     'django.middleware.clickjacking.XFrameOptionsMiddleware',
-    'mgr.middleware.LogContextMiddleware'
 ]
 
 ROOT_URLCONF = 'mgr.urls'
@@ -156,12 +155,19 @@ if platform.system() == 'Windows' or 'test' in sys.argv:
     }
 else:
     LOGGING_CONFIG = None
-    LOGGING_FILE = os.path.join(BASE_DIR, 'mgr/log.yml')
-    config.yamlConfig(filepath=LOGGING_FILE, watchDog=True)
 
+    log_path = '/var/log/onap/vfc/gvnfm-vnfmgr'
+    if not os.path.exists(log_path):
+        os.makedirs(log_path)
+
+    LOGGING_FILE = os.path.join(BASE_DIR, 'mgr/log.yml')
+    with open(file=LOGGING_FILE, mode='r', encoding="utf-8")as file:
+        logging_yaml = yaml.load(stream=file, Loader=yaml.FullLoader)
+    config.dictConfig(config=logging_yaml)
 
 if 'test' in sys.argv:
     from mgr.pub.config import config
+
     config.REG_TO_MSB_WHEN_START = False
     DATABASES = {}
     DATABASES['default'] = {