From 681928ddc750c28b12ec5097aff0dc694a5275d6 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Mon, 7 Feb 2011 01:32:53 +0000 Subject: syncdaemon: display slave role in log output Signed-off-by: Csaba Henk Signed-off-by: Anand V. Avati BUG: 2379 (master and slave log should be easier to distinguish) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2379 --- xlators/features/marker/utils/syncdaemon/gsyncd.py | 10 +++++++--- xlators/features/marker/utils/syncdaemon/resource.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py index f84df502185..5a9ead66579 100644 --- a/xlators/features/marker/utils/syncdaemon/gsyncd.py +++ b/xlators/features/marker/utils/syncdaemon/gsyncd.py @@ -36,8 +36,12 @@ class GLogger(Logger): @classmethod def setup(cls, **kw): + if kw.get('slave'): + sls = "(slave)" + else: + sls = "" lprm = {'datefmt': "%Y-%m-%d %H:%M:%S", - 'format': "[%(asctime)s.%(nsecs)d] %(lvlnam)s [%(module)s:%(lineno)s:%(funcName)s] %(ctx)s: %(message)s"} + 'format': "[%(asctime)s.%(nsecs)d] %(lvlnam)s [%(module)s" + sls + ":%(lineno)s:%(funcName)s] %(ctx)s: %(message)s"} lprm.update(kw) lvl = kw.get('level', logging.INFO) if isinstance(lvl, str): @@ -93,7 +97,7 @@ def startup(**kw): lkw = {'level': gconf.log_level} if kw.get('log_file'): lkw['filename'] = kw['log_file'] - GLogger.setup(**lkw) + GLogger.setup(slave=kw.get('slave'), **lkw) def finalize(*a): if getattr(gconf, 'pid_file', None): @@ -211,7 +215,7 @@ def main_i(): log_file = None else: log_file = gconf.log_file - startup(go_daemon=go_daemon, log_file=log_file) + startup(go_daemon=go_daemon, log_file=log_file, slave=(not remote)) logging.info("syncing: %s" % " -> ".join([x.url for x in [local, remote] if x])) if remote: diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py index bbf7459bb55..93199f51857 100644 --- a/xlators/features/marker/utils/syncdaemon/resource.py +++ b/xlators/features/marker/utils/syncdaemon/resource.py @@ -303,7 +303,7 @@ class GLUSTER(AbstractUrl, SlaveLocal, SlaveRemote): try: os.rmdir(d) except: - logging.warn('stale mount left behind on ' + d) + logging.warn('stale mount possibly left behind on ' + d) logging.debug('auxiliary glusterfs mount prepared') def connect_remote(self, *a, **kw): -- cgit