diff options
-rw-r--r-- | newton/assembly.xml | 1 | ||||
-rw-r--r-- | newton/newton/pub/__init__.py | 14 | ||||
-rw-r--r-- | newton/newton/pub/config/__init__.py | 14 | ||||
-rw-r--r-- | newton/newton/pub/config/config.py | 13 | ||||
-rw-r--r-- | newton/newton/pub/config/log.yml | 34 | ||||
-rw-r--r-- | newton/newton/settings.py | 39 | ||||
-rw-r--r-- | newton/pom.xml | 70 | ||||
-rw-r--r-- | newton/requirements.txt | 4 | ||||
-rwxr-xr-x | newton/run.sh | 8 | ||||
-rw-r--r-- | newton/tox.ini | 2 | ||||
-rw-r--r-- | ocata/assembly.xml | 1 | ||||
-rw-r--r-- | ocata/ocata/pub/__init__.py | 14 | ||||
-rw-r--r-- | ocata/ocata/pub/config/__init__.py | 14 | ||||
-rw-r--r-- | ocata/ocata/pub/config/config.py | 13 | ||||
-rw-r--r-- | ocata/ocata/pub/config/log.yml | 34 | ||||
-rw-r--r-- | ocata/ocata/settings.py | 51 | ||||
-rw-r--r-- | ocata/pom.xml | 8 | ||||
-rw-r--r-- | ocata/requirements.txt | 3 | ||||
-rw-r--r-- | ocata/tox.ini | 2 | ||||
-rw-r--r-- | windriver/assembly.xml | 1 | ||||
-rw-r--r-- | windriver/pom.xml | 8 | ||||
-rw-r--r-- | windriver/requirements.txt | 4 | ||||
-rw-r--r-- | windriver/titanium_cloud/pub/config/log.yml | 34 | ||||
-rw-r--r-- | windriver/titanium_cloud/settings.py | 52 | ||||
-rw-r--r-- | windriver/tox.ini | 2 |
25 files changed, 273 insertions, 167 deletions
diff --git a/newton/assembly.xml b/newton/assembly.xml index 55d172a1..d0dbea27 100644 --- a/newton/assembly.xml +++ b/newton/assembly.xml @@ -31,6 +31,7 @@ <include>**/*.wsdl</include> <include>**/*.xsd</include> <include>**/*.bpel</include> + <include>**/*.yml</include> </includes> </fileSet> <fileSet> diff --git a/newton/newton/pub/__init__.py b/newton/newton/pub/__init__.py new file mode 100644 index 00000000..afa702d3 --- /dev/null +++ b/newton/newton/pub/__init__.py @@ -0,0 +1,14 @@ +# Copyright (c) 2017-2018 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/newton/newton/pub/config/__init__.py b/newton/newton/pub/config/__init__.py new file mode 100644 index 00000000..afa702d3 --- /dev/null +++ b/newton/newton/pub/config/__init__.py @@ -0,0 +1,14 @@ +# Copyright (c) 2017-2018 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/newton/newton/pub/config/config.py b/newton/newton/pub/config/config.py new file mode 100644 index 00000000..ae1ce9db --- /dev/null +++ b/newton/newton/pub/config/config.py @@ -0,0 +1,13 @@ +# Copyright (c) 2017-2018 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/newton/newton/pub/config/log.yml b/newton/newton/pub/config/log.yml new file mode 100644 index 00000000..452d3b61 --- /dev/null +++ b/newton/newton/pub/config/log.yml @@ -0,0 +1,34 @@ +version: 1 +disable_existing_loggers: False + +loggers: + newton: + handlers: [newton_handler] + level: "DEBUG" + propagate: False + newton_base: + handlers': [newton_handler] + level: "DEBUG" + propagate: False + common: + handlers: [newton_handler] + level: "DEBUG" + propagate: False +handlers: + newton_handler: + level: "DEBUG" + class: "logging.handlers.RotatingFileHandler" + filename: "/var/log/onap/multicloud/openstack/newton/newton.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/newton/newton/settings.py b/newton/newton/settings.py index 4b08d2a6..a5585a68 100644 --- a/newton/newton/settings.py +++ b/newton/newton/settings.py @@ -15,6 +15,10 @@ import os import sys +from logging import config +from onaplogging import monkey +monkey.patch_all() + DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', @@ -84,36 +88,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': { - 'newton_handler': { - 'level': 'DEBUG', - 'class': 'logging.handlers.RotatingFileHandler', - 'filename': os.path.join(BASE_DIR, 'logs/runtime_newton.log'), - 'formatter': 'standard', - 'maxBytes': 1024 * 1024 * 50, - 'backupCount': 5, - }, - }, - - 'loggers': { - 'newton': { - 'handlers': ['newton_handler'], - 'level': 'DEBUG', - 'propagate': False - }, - } -} - CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', @@ -147,8 +121,13 @@ ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__fi OPENSTACK_VERSION = "newton" MULTIVIM_VERSION = "multicloud-" + OPENSTACK_VERSION +LOGGING_CONFIG = None +# yaml configuration of logging +LOGGING_FILE = os.path.join(BASE_DIR, 'newton/pub/config/log.yml') +config.yamlConfig(filepath=LOGGING_FILE, watchDog=True) if 'test' in sys.argv: + #LOGGING['handlers']['newton_handler']['filename'] = 'logs/newton.log' REST_FRAMEWORK = {} import platform diff --git a/newton/pom.xml b/newton/pom.xml index 091b6519..c0401c1a 100644 --- a/newton/pom.xml +++ b/newton/pom.xml @@ -61,42 +61,42 @@ </environmentVariables> </configuration> </plugin> - </plugins> - </pluginManagement> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> - <version>1.2.1</version> - <executions> - <execution> - <id>clean phase script</id> - <phase>clean</phase> - <goals> - <goal>exec</goal> - </goals> - <configuration> - <arguments> - <argument>__</argument> - <argument>clean</argument> - </arguments> - </configuration> - </execution> - <execution> - <id>test script</id> - <phase>test</phase> - <goals> - <goal>exec</goal> - </goals> - <configuration> - <arguments> - <argument>__</argument> - <argument>test</argument> - </arguments> - </configuration> - </execution> - </executions> - </plugin> + <version>1.2.1</version> + <executions> + <execution> + <id>clean phase script</id> + <phase>clean</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>__</argument> + <argument>clean</argument> + </arguments> + </configuration> + </execution> + <execution> + <id>test script</id> + <phase>test</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <arguments> + <argument>__</argument> + <argument>test</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> diff --git a/newton/requirements.txt b/newton/requirements.txt index cb42f78c..df84bef5 100644 --- a/newton/requirements.txt +++ b/newton/requirements.txt @@ -17,3 +17,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/newton/run.sh b/newton/run.sh index 0e2bee32..43de581f 100755 --- a/newton/run.sh +++ b/newton/run.sh @@ -17,8 +17,12 @@ memcached -d -m 2048 -u root -c 1024 -p 11211 -P /tmp/memcached1.pid export PYTHONPATH=lib/share nohup python manage.py runserver 0.0.0.0:9003 2>&1 & -while [ ! -f logs/runtime_newton.log ]; do +logDir="/var/log/onap/multicloud/openstack/newton" +if [ ! -x $logDir ]; then + mkdir -p $logDir +fi +while [ ! -f $logDir/newton.log ]; do sleep 1 done -tail -F logs/runtime_newton.log +tail -F $logDir/newton.log diff --git a/newton/tox.ini b/newton/tox.ini index 4be77268..e3334cf1 100644 --- a/newton/tox.ini +++ b/newton/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py35,cov +envlist = py27,cov skipsdist = true [tox:jenkins] diff --git a/ocata/assembly.xml b/ocata/assembly.xml index e934f9f6..1c69acd6 100644 --- a/ocata/assembly.xml +++ b/ocata/assembly.xml @@ -31,6 +31,7 @@ <include>**/*.wsdl</include> <include>**/*.xsd</include> <include>**/*.bpel</include> + <include>**/*.yml</include> </includes> </fileSet> <fileSet> diff --git a/ocata/ocata/pub/__init__.py b/ocata/ocata/pub/__init__.py new file mode 100644 index 00000000..afa702d3 --- /dev/null +++ b/ocata/ocata/pub/__init__.py @@ -0,0 +1,14 @@ +# Copyright (c) 2017-2018 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/ocata/ocata/pub/config/__init__.py b/ocata/ocata/pub/config/__init__.py new file mode 100644 index 00000000..afa702d3 --- /dev/null +++ b/ocata/ocata/pub/config/__init__.py @@ -0,0 +1,14 @@ +# Copyright (c) 2017-2018 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + diff --git a/ocata/ocata/pub/config/config.py b/ocata/ocata/pub/config/config.py new file mode 100644 index 00000000..ae1ce9db --- /dev/null +++ b/ocata/ocata/pub/config/config.py @@ -0,0 +1,13 @@ +# Copyright (c) 2017-2018 Wind River Systems, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/ocata/ocata/pub/config/log.yml b/ocata/ocata/pub/config/log.yml new file mode 100644 index 00000000..224864d1 --- /dev/null +++ b/ocata/ocata/pub/config/log.yml @@ -0,0 +1,34 @@ +version: 1 +disable_existing_loggers: False + +loggers: + ocata: + handlers: [ocata_handler] + level: "DEBUG" + propagate: False + newton_base: + handlers': [ocata_handler] + level: "DEBUG" + propagate: False + common: + handlers: [ocata_handler] + level: "DEBUG" + propagate: False +handlers: + ocata_handler: + level: "DEBUG" + class: "logging.handlers.RotatingFileHandler" + filename: "/var/log/onap/multicloud/openstack/ocata/ocata.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/ocata/ocata/settings.py b/ocata/ocata/settings.py index 9f5711d6..169d83ea 100644 --- a/ocata/ocata/settings.py +++ b/ocata/ocata/settings.py @@ -15,6 +15,10 @@ 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, ...) @@ -77,46 +81,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': { - 'ocata_handler': { - 'level': 'DEBUG', - 'class': 'logging.handlers.RotatingFileHandler', - 'filename': '/var/log/onap/multicloud/openstack/ocata/ocata.log', - 'formatter': 'standard', - 'maxBytes': 1024 * 1024 * 50, - 'backupCount': 5, - }, - }, - - 'loggers': { - 'ocata': { - 'handlers': ['ocata_handler'], - 'level': 'DEBUG', - 'propagate': False - }, - 'newton_base': { - 'handlers': ['ocata_handler'], - 'level': 'DEBUG', - 'propagate': False - }, - 'common': { - 'handlers': ['ocata_handler'], - 'level': 'DEBUG', - 'propagate': False - }, - } -} - CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', @@ -150,9 +114,14 @@ ROOT_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__fi OPENSTACK_VERSION = "ocata" MULTIVIM_VERSION = "multicloud-" + OPENSTACK_VERSION +LOGGING_CONFIG = None +# yaml configuration of logging +LOGGING_FILE = os.path.join(BASE_DIR, 'ocata/pub/config/log.yml') +config.yamlConfig(filepath=LOGGING_FILE, watchDog=True) + if 'test' in sys.argv: - LOGGING['handlers']['ocata_handler']['filename'] = 'logs/ocata.log' + #LOGGING['handlers']['ocata_handler']['filename'] = 'logs/ocata.log' REST_FRAMEWORK = {} import platform diff --git a/ocata/pom.xml b/ocata/pom.xml index aae5c5b7..51d9a95e 100644 --- a/ocata/pom.xml +++ b/ocata/pom.xml @@ -28,14 +28,6 @@ <packaging>pom</packaging> <name>multicloud/openstack/ocata</name> <description>multicloud for openstack ocata</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/ocata/requirements.txt b/ocata/requirements.txt index 841fe278..76a3c0b1 100644 --- a/ocata/requirements.txt +++ b/ocata/requirements.txt @@ -15,3 +15,6 @@ 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/ocata/tox.ini b/ocata/tox.ini index be63b80f..2fb81e7f 100644 --- a/ocata/tox.ini +++ b/ocata/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py35,cov +envlist = py27,cov skipsdist = true [tox:jenkins] 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] |