diff options
author | dyh <dengyuanhong@chinamobile.com> | 2021-02-21 20:05:56 +0800 |
---|---|---|
committer | dyh <dengyuanhong@chinamobile.com> | 2021-02-21 20:07:25 +0800 |
commit | 5c66635c3519f11c788598ac5b343c4f2c44a6a0 (patch) | |
tree | 66423f2dad1d42cf2a4d71ab74d6af5a67eab6bd /zte/vmanager/driver/settings.py | |
parent | 853f2970c1566825efe2e96caa6c2e7c8e7d23e0 (diff) |
Remove dependency on onaplogging in ztedriver
Change-Id: I7a23d4ddc656d304f89265639bf06237ebd15e55
Issue-ID: VFC-1813
Signed-off-by: dyh <dengyuanhong@chinamobile.com>
Diffstat (limited to 'zte/vmanager/driver/settings.py')
-rw-r--r-- | zte/vmanager/driver/settings.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/zte/vmanager/driver/settings.py b/zte/vmanager/driver/settings.py index ddc2a86a..a9e0d3d2 100644 --- a/zte/vmanager/driver/settings.py +++ b/zte/vmanager/driver/settings.py @@ -16,10 +16,9 @@ import os import sys import platform from logging import config -from onaplogging import monkey -monkey.patch_all() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) +import yaml BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -60,7 +59,6 @@ MIDDLEWARE_CLASSES = [ 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', - 'driver.middleware.LogContextMiddleware', ] ROOT_URLCONF = 'driver.urls' @@ -148,9 +146,17 @@ if platform.system() == 'Windows' or 'test' in sys.argv: }} else: LOGGING_CONFIG = None + + log_path = '/var/log/onap/vfc/ztevnfmdriver' + if not os.path.exists(log_path): + os.makedirs(log_path) + # yaml configuration of logging LOGGING_FILE = os.path.join(BASE_DIR, 'driver/log.yml') config.yamlConfig(filepath=LOGGING_FILE, watchDog=True) + 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: |