Skip to content
Permalink
Browse files

Fix the service logger log routing

  • Loading branch information...
cvaroqui committed Jul 14, 2019
1 parent d24e295 commit 1cf720d41a2731987375f7ab28d7802ce40e28dd
Showing with 13 additions and 15 deletions.
  1. +5 −1 lib/node.py
  2. +2 −1 lib/osvcd.py
  3. +2 −11 lib/rcLogger.py
  4. +2 −1 lib/svc.py
  5. +2 −1 lib/svcBuilder.py
@@ -179,10 +179,14 @@ def __init__(self):
value=None,
extra_argv=[],
)
self.log = rcLogger.initLogger(rcEnv.nodename)
self.stats_data = {}
self.stats_updated = 0

@lazy
def log(self):
log_file = os.path.join(rcEnv.paths.pathlog, "node.log")
return rcLogger.initLogger(rcEnv.nodename, log_file)

def get_node(self):
"""
helper for the comm module to find the Node(), for accessing
@@ -120,7 +120,8 @@ def __init__(self):
self.handlers = None
self.threads = {}
self.last_config_mtime = None
rcLogger.initLogger(rcEnv.nodename, handlers=self.handlers)
log_file = os.path.join(rcEnv.paths.pathlog, "node.log")
rcLogger.initLogger(rcEnv.nodename, log_file, handlers=self.handlers)
rcLogger.set_namelen(force=30)
self.log = logging.getLogger(rcEnv.nodename+".osvcd")
self.pid = os.getpid()
@@ -147,19 +147,10 @@ def set_namelen(svcs=[], force=None):
namelen = maxlen
namefmt = "%-"+str(namelen)+"s"

def initLogger(name, directory=rcEnv.paths.pathlog, handlers=None):
def initLogger(root, logfile, handlers=None):
if handlers is None:
handlers = DEFAULT_HANDLERS

if name == rcEnv.nodename:
logfile = os.path.join(directory, "node.log")
else:
if name.startswith(rcEnv.nodename):
_name = name.replace(rcEnv.nodename+".", "", 1)
else:
_name = name
logfile = os.path.join(directory, _name + '.log')
log = logging.getLogger(name)
log = logging.getLogger(root)
log.propagate = False
log.handlers = []

@@ -608,7 +608,8 @@ def log(self): # pylint: disable=method-hidden
handlers = ["stream"]
else:
handlers = None
return rcLogger.initLogger(self.loggerpath, directory=self.log_d, handlers=handlers)
log_file = os.path.join(self.log_d, self.name+".log")
return rcLogger.initLogger(self.loggerpath, log_file, handlers=handlers)

@lazy
def compliance(self):
@@ -1627,7 +1627,8 @@ class Logger instance name: 'log'
max_path_len = n

rcLogger.max_path_len = max_path_len
rcLogger.initLogger(rcEnv.nodename)
log_file = os.path.join(rcEnv.paths.pathlog, "node.log")
rcLogger.initLogger(rcEnv.nodename, log_file)

def add_resources(svc):
"""

0 comments on commit 1cf720d

Please sign in to comment.
You can’t perform that action at this time.