summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYun Huang <yun.huang@windriver.com>2018-03-15 16:15:11 +0800
committerYun Huang <yun.huang@windriver.com>2018-03-15 16:15:11 +0800
commitcabc350593488b32980bd3310754018e99a48945 (patch)
tree8ca2026d153a2f849a93079ee81012705fcb4bb9
parent1bf84e64ce12d1e34fe5d72d6fc0411aed20cf26 (diff)
Enable AOP for titanium cloud logging
Change-Id: Id441583c85845a71614577046f0c5b062e09580d Issue-ID: MULTICLOUD-177 Signed-off-by: Yun Huang <yun.huang@windriver.com>
-rw-r--r--windriver/assembly.xml1
-rw-r--r--windriver/pom.xml8
-rw-r--r--windriver/requirements.txt4
-rw-r--r--windriver/titanium_cloud/pub/config/log.yml34
-rw-r--r--windriver/titanium_cloud/settings.py52
-rw-r--r--windriver/tox.ini2
6 files changed, 52 insertions, 49 deletions
diff --git a/windriver/assembly.xml b/windriver/assembly.xml
index 518b10da..f6c502b1 100644
--- a/windriver/assembly.xml
+++ b/windriver/assembly.xml
@@ -31,6 +31,7 @@
<include>**/*.wsdl</include>
<include>**/*.xsd</include>
<include>**/*.bpel</include>
+ <include>**/*.yml</include>
</includes>
</fileSet>
<fileSet>
diff --git a/windriver/pom.xml b/windriver/pom.xml
index f898ce1d..eb13fb6d 100644
--- a/windriver/pom.xml
+++ b/windriver/pom.xml
@@ -28,14 +28,6 @@
<packaging>pom</packaging>
<name>multicloud/openstack/windriver</name>
<description>multicloud for openstack Wind River Titanium Cloud</description>
- <dependencies>
- <dependency>
- <groupId>org.onap.multicloud.openstack</groupId>
- <artifactId>multicloud-openstack-newton</artifactId>
- <version>1.1.0</version>
- <type>zip</type>
- </dependency>
- </dependencies>
<properties>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/windriver/requirements.txt b/windriver/requirements.txt
index 841fe278..25a691a6 100644
--- a/windriver/requirements.txt
+++ b/windriver/requirements.txt
@@ -15,3 +15,7 @@ python-memcached
coverage==4.2
mock==2.0.0
unittest_xml_reporting==1.12.0
+
+# for onap logging
+onappylog>=1.0.5
+
diff --git a/windriver/titanium_cloud/pub/config/log.yml b/windriver/titanium_cloud/pub/config/log.yml
new file mode 100644
index 00000000..7dab297b
--- /dev/null
+++ b/windriver/titanium_cloud/pub/config/log.yml
@@ -0,0 +1,34 @@
+version: 1
+disable_existing_loggers: False
+
+loggers:
+ titanium_cloud:
+ handlers: [titanium_cloud_handler]
+ level: "DEBUG"
+ propagate: False
+ newton_base:
+ handlers': [titanium_cloud_handler]
+ level: "DEBUG"
+ propagate: False
+ common:
+ handlers: [titanium_cloud_handler]
+ level: "DEBUG"
+ propagate: False
+handlers:
+ titanium_cloud_handler:
+ level: "DEBUG"
+ class: "logging.handlers.RotatingFileHandler"
+ filename: "/var/log/onap/multicloud/openstack/windriver/titanium_cloud.log"
+ formatter: "mdcFormat"
+ maxBytes: 1024*1024*50
+ backupCount: 10
+formatters:
+ standard:
+ format: "%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:%(message)s"
+ mdcFormat:
+ format: "%(asctime)s:[%(name)s]:[%(filename)s]-[%(lineno)d] [%(levelname)s]:[%(mdc)s]: %(message)s"
+ mdcfmt: "{requestID}"
+ datefmt: "%Y-%m-%d %H:%M:%S"
+ (): onaplogging.mdcformatter.MDCFormatter
+
+
diff --git a/windriver/titanium_cloud/settings.py b/windriver/titanium_cloud/settings.py
index 81e19fb2..88bba77d 100644
--- a/windriver/titanium_cloud/settings.py
+++ b/windriver/titanium_cloud/settings.py
@@ -15,6 +15,11 @@
import os
import sys
+from logging import config
+from onaplogging import monkey
+monkey.patch_all()
+
+
CACHE_EXPIRATION_TIME = 3600
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
@@ -75,45 +80,6 @@ TIME_ZONE = 'UTC'
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': {
- 'titanium_cloud_handler': {
- 'level': 'DEBUG',
- 'class': 'logging.handlers.RotatingFileHandler',
- 'filename': '/var/log/onap/multicloud/openstack/windriver/titanium_cloud.log',
- 'formatter': 'standard',
- 'maxBytes': 1024 * 1024 * 50,
- 'backupCount': 5,
- },
- },
-
- 'loggers': {
- 'titanium_cloud': {
- 'handlers': ['titanium_cloud_handler'],
- 'level': 'DEBUG',
- 'propagate': False
- },
- 'newton_base': {
- 'handlers': ['titanium_cloud_handler'],
- 'level': 'DEBUG',
- 'propagate': False
- },
- 'common': {
- 'handlers': ['titanium_cloud_handler'],
- 'level': 'DEBUG',
- 'propagate': False
- },
- }
-}
DEFAULT_MSB_ADDR = "127.0.0.1"
DEFAULT_CACHE_BACKEND_LOCATION = '127.0.0.1:11211'
@@ -151,9 +117,15 @@ ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__fi
OPENSTACK_VERSION = "titanium_cloud"
MULTIVIM_VERSION = "multicloud-" + OPENSTACK_VERSION
+
+LOGGING_CONFIG = None
+# yaml configuration of logging
+LOGGING_FILE = os.path.join(BASE_DIR, 'titanium_cloud/pub/config/log.yml')
+config.yamlConfig(filepath=LOGGING_FILE, watchDog=True)
+
if 'test' in sys.argv:
- LOGGING['handlers']['titanium_cloud_handler']['filename'] = 'logs/titanium_cloud.log'
+ #LOGGING['handlers']['titanium_cloud_handler']['filename'] = 'logs/titanium_cloud.log'
REST_FRAMEWORK = {}
import platform
diff --git a/windriver/tox.ini b/windriver/tox.ini
index 3a12bd31..113f9c1b 100644
--- a/windriver/tox.ini
+++ b/windriver/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27,py35,cov
+envlist = py27,cov
skipsdist = true
[tox:jenkins]