From bba3767276ec933f72472574405329be7d3fec90 Mon Sep 17 00:00:00 2001 From: Lisa Zangrando Date: Thu, 11 May 2017 12:04:59 +0200 Subject: [PATCH] The synergy.log doesn't contain all logged messages Not all messages are logged in synergy.log (e.g. the ones logged by the modules in synergy_scheduler_manager/common). This fix solves the problem. Bug: 1690113 Change-Id: I861f7281a1e2cc2a49567ab97482234f834919f4 Sem-Ver: bugfix --- synergy/service.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/synergy/service.py b/synergy/service.py index 4b7d7f0..2a47a40 100644 --- a/synergy/service.py +++ b/synergy/service.py @@ -66,14 +66,15 @@ def setLogger(name): # set logger level logger = logging.getLogger(name) - logger.propagate = False - try: - logger.setLevel(cfg.CONF.Logger.level) - except ValueError: # wrong level, we default to INFO - logger.setLevel(logging.INFO) + if not len(logger.handlers): + try: + logger.setLevel(cfg.CONF.Logger.level) + except ValueError: # wrong level, we default to INFO + logger.setLevel(logging.INFO) - logger.addHandler(handler) + logger.propagate = False + logger.addHandler(handler) class Synergy(Service): @@ -104,6 +105,7 @@ class Synergy(Service): manager_obj.setRate(CONF.get(entry.name).rate) # Configure logging for manager + setLogger(manager_obj.__module__.rsplit('.', 1)[0]) setLogger(manager_obj.__module__) self.managers[manager_obj.getName()] = manager_obj