From c2d9b66f8cc78398a8c934b5330105cb15ddb4ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Ollivier?= Date: Thu, 25 Apr 2019 14:32:12 +0200 Subject: [PATCH] Leverage on DEBUG env var MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It allows muting debug logs. Change-Id: I291f3bb7e0a450724a34997c720bde01f72c8e50 Signed-off-by: Cédric Ollivier (cherry picked from commit d777f2e588a321d5c01e2e50ffa5c8fc5a27c77c) --- docker/core/Dockerfile | 1 + functest/ci/logging.debug.ini | 115 ++++++++++++++++++++++++++++++++++++++++++ functest/ci/logging.ini | 16 +++--- functest/utils/env.py | 1 + upper-constraints.txt | 2 +- 5 files changed, 126 insertions(+), 9 deletions(-) create mode 100644 functest/ci/logging.debug.ini diff --git a/docker/core/Dockerfile b/docker/core/Dockerfile index 5ba41a273..728ae6dc9 100644 --- a/docker/core/Dockerfile +++ b/docker/core/Dockerfile @@ -28,6 +28,7 @@ RUN apk --no-cache add --update \ /src/functest && \ rm -r upper-constraints.opnfv.txt /src/functest && \ cp /usr/lib/python2.7/site-packages/functest/ci/logging.ini /usr/lib/python2.7/site-packages/xtesting/ci/ && \ + cp /usr/lib/python2.7/site-packages/functest/ci/logging.debug.ini /usr/lib/python2.7/site-packages/xtesting/ci/ && \ bash -c "mkdir -p /var/lib/xtesting /home/opnfv" && \ ln -s /var/lib/xtesting /home/opnfv/functest && \ bash -c "mkdir -p /home/opnfv/functest{/conf,/data,/images,/results} /home/opnfv/repos/vnfs" && \ diff --git a/functest/ci/logging.debug.ini b/functest/ci/logging.debug.ini new file mode 100644 index 000000000..51ee359c6 --- /dev/null +++ b/functest/ci/logging.debug.ini @@ -0,0 +1,115 @@ +[loggers] +keys=root,functest,api,ci,core,cli,opnfv_tests,utils,xtesting,xci,xcore,energy,xutils,sfc,baro,warnings + +[handlers] +keys=console,wconsole,file,dfile + +[formatters] +keys=standard + +[logger_root] +level=NOTSET +handlers=dfile + +[logger_functest] +level=NOTSET +handlers=file +qualname=functest + +[logger_api] +level=NOTSET +handlers=wconsole +qualname=functest.api + +[logger_ci] +level=NOTSET +handlers=console +qualname=functest.ci + +[logger_core] +level=NOTSET +handlers=console +qualname=functest.core + +[logger_cli] +level=NOTSET +handlers=wconsole +qualname=functest.cli + +[logger_opnfv_tests] +level=NOTSET +handlers=wconsole +qualname=functest.opnfv_tests + +[logger_utils] +level=NOTSET +handlers=wconsole +qualname=functest.utils + +[logger_xtesting] +level=NOTSET +handlers=file +qualname=xtesting + +[logger_xci] +level=NOTSET +handlers=console +qualname=xtesting.ci + +[logger_xcore] +level=NOTSET +handlers=console +qualname=xtesting.core + +[logger_energy] +level=NOTSET +handlers=wconsole +qualname=xtesting.energy + +[logger_xutils] +level=NOTSET +handlers=wconsole +qualname=xtesting.utils + +[logger_sfc] +level=NOTSET +handlers=file,wconsole +qualname=sfc + +[logger_baro] +level=NOTSET +handlers=file,wconsole +qualname=baro_tests + +[logger_warnings] +level=NOTSET +handlers=file,console +qualname=py.warnings + +[handler_console] +class=StreamHandler +level=INFO +formatter=standard +args=(sys.stdout,) + +[handler_wconsole] +class=StreamHandler +level=WARN +formatter=standard +args=(sys.stdout,) + +[handler_file] +class=FileHandler +level=DEBUG +formatter=standard +args=("/home/opnfv/functest/results/functest.log",) + +[handler_dfile] +class=FileHandler +level=DEBUG +formatter=standard +args=("/home/opnfv/functest/results/functest.debug.log",) + +[formatter_standard] +format=%(asctime)s - %(name)s - %(levelname)s - %(message)s +datefmt= diff --git a/functest/ci/logging.ini b/functest/ci/logging.ini index 51ee359c6..278529e22 100644 --- a/functest/ci/logging.ini +++ b/functest/ci/logging.ini @@ -2,14 +2,14 @@ keys=root,functest,api,ci,core,cli,opnfv_tests,utils,xtesting,xci,xcore,energy,xutils,sfc,baro,warnings [handlers] -keys=console,wconsole,file,dfile +keys=console,wconsole,file,null [formatters] keys=standard [logger_root] level=NOTSET -handlers=dfile +handlers=null [logger_functest] level=NOTSET @@ -86,6 +86,12 @@ level=NOTSET handlers=file,console qualname=py.warnings +[handler_null] +class=NullHandler +level=NOTSET +formatter=standard +args=() + [handler_console] class=StreamHandler level=INFO @@ -104,12 +110,6 @@ level=DEBUG formatter=standard args=("/home/opnfv/functest/results/functest.log",) -[handler_dfile] -class=FileHandler -level=DEBUG -formatter=standard -args=("/home/opnfv/functest/results/functest.debug.log",) - [formatter_standard] format=%(asctime)s - %(name)s - %(levelname)s - %(message)s datefmt= diff --git a/functest/utils/env.py b/functest/utils/env.py index e202f45b9..c761f309b 100644 --- a/functest/utils/env.py +++ b/functest/utils/env.py @@ -17,6 +17,7 @@ from xtesting.utils import env INPUTS = { 'EXTERNAL_NETWORK': None, 'CI_LOOP': env.INPUTS['CI_LOOP'], + 'DEBUG': env.INPUTS['DEBUG'], 'DEPLOY_SCENARIO': env.INPUTS['DEPLOY_SCENARIO'], 'INSTALLER_TYPE': env.INPUTS['INSTALLER_TYPE'], 'SDN_CONTROLLER_IP': None, diff --git a/upper-constraints.txt b/upper-constraints.txt index 279683b89..a9a45d70c 100644 --- a/upper-constraints.txt +++ b/upper-constraints.txt @@ -15,7 +15,7 @@ robotframework-httplibrary===0.4.2 robotframework-requests===0.4.7 robotframework-sshlibrary===2.1.3;python_version=='2.7' ansible===2.3.2.0 -xtesting===0.61.0 +xtesting===0.62.0 networking-bgpvpn===9.0.0 networking-sfc===7.0.0 neutron===13.0.2 -- 2.16.6