Stop using internal oslo_log.log._loggers dict

We are currently using `_loggers` internal dictionary from oslo_log for
the dynamic log reconfiguration, which is not ideal.

This patch uses the newly added `get_loggers` public method instead.

Depends-On: Ife33a5dd044a4565ad6a4d559ef9f0c108f260a3
TrivialFix

Change-Id: I9f3277320673de7687f0f387f1f50fdc5ebffd08
This commit is contained in:
Gorka Eguileor 2017-06-26 17:16:56 +02:00
parent 8c2f4876f5
commit 7ac9b07102

View File

@ -1123,7 +1123,7 @@ def set_log_levels(prefix, level_string):
level = get_log_method(level_string)
prefix = prefix or ''
for k, v in logging._loggers.items():
for k, v in logging.get_loggers().items():
if k and k.startswith(prefix):
v.logger.setLevel(level)
@ -1131,7 +1131,7 @@ def set_log_levels(prefix, level_string):
def get_log_levels(prefix):
prefix = prefix or ''
return {k: logging.logging.getLevelName(v.logger.getEffectiveLevel())
for k, v in logging._loggers.items()
for k, v in logging.get_loggers().items()
if k and k.startswith(prefix)}