diff options
| author | Csaba Henk <csaba@gluster.com> | 2011-02-07 01:32:53 +0000 | 
|---|---|---|
| committer | Anand V. Avati <avati@dev.gluster.com> | 2011-02-07 00:59:00 -0800 | 
| commit | 681928ddc750c28b12ec5097aff0dc694a5275d6 (patch) | |
| tree | 0e44cb49171e0937afaef5bf80d96f34a25016c8 | |
| parent | e266833e72749368019b7dcae32dc206d180acdd (diff) | |
syncdaemon: display slave role in log output
Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 2379 (master and slave log should be easier to distinguish)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2379
| -rw-r--r-- | xlators/features/marker/utils/syncdaemon/gsyncd.py | 10 | ||||
| -rw-r--r-- | xlators/features/marker/utils/syncdaemon/resource.py | 2 | 
2 files changed, 8 insertions, 4 deletions
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):  | 
