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
This commit is contained in:
Lisa Zangrando 2017-05-11 12:04:59 +02:00
parent 16d1843455
commit bba3767276

View File

@ -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