Added option to enable additional loggers
Fixes PROD-34686
Change-Id: Ibda9460e6fe1a0a2b6a504a7a9834ca17dde7c2b
diff --git a/oslo_templates/files/logging/_logging.conf b/oslo_templates/files/logging/_logging.conf
index 3da84c0..ecbc0e8 100644
--- a/oslo_templates/files/logging/_logging.conf
+++ b/oslo_templates/files/logging/_logging.conf
@@ -1,13 +1,20 @@
{%- set log_handlers = [] -%}
{%- set app_name = _data.app_name -%}
-{%- for log_handler_name, log_handler_attrs in _data.log_handlers.items() %}
+{%- for log_handler_name, log_handler_attrs in _data.get('log_handlers', {}).iteritems() %}
{%- if log_handler_attrs.get('enabled', False) %}
{%- do log_handlers.append(log_handler_name) -%}
{%- endif %}
{%- endfor %}
+{%- set loggers = ["root", app_name] -%}
+{%- for _logger_name, _logger_attrs in _data.get('loggers', {}).iteritems() %}
+ {%- if _logger_attrs.get('enabled', False) and _logger_name not in loggers %}
+ {%- do loggers.append(_logger_name) -%}
+ {%- endif %}
+{%- endfor %}
+
[loggers]
-keys = root, {{ app_name }}
+keys = {{ loggers | join(", ") }}
[handlers]
keys = {{ log_handlers | join(", ") }}
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index f626112..5b1282b 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -38,6 +38,9 @@
virtualenv $VENV_DIR
source ${VENV_DIR}/bin/activate
python -m pip install salt${PIP_SALT_VERSION}
+ if [[ -f ${CURDIR}/test-requirements.txt ]]; then
+ python -m pip install -r ${CURDIR}/test-requirements.txt
+ fi
}
setup_test_state() {
diff --git a/tests/test-requirements.txt b/tests/test-requirements.txt
index 7188b2b..bc7dc7f 100644
--- a/tests/test-requirements.txt
+++ b/tests/test-requirements.txt
@@ -1,3 +1,4 @@
jsonschema
reno
setuptools<45.0.0
+msgpack<1.0.0