From 215a8352e2219c7ead29693ccab3452054a89041 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Thu, 31 Mar 2011 03:29:35 +0000 Subject: syncdaemon: fix "--debug" option of gsyncd.py also be explicit about logging to a stream (ie. don't rely on the feature of accessing stdin through /dev/stdin) Signed-off-by: Csaba Henk Signed-off-by: Vijay Bellur BUG: 2637 (gsyncd --debug broken) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2637 --- xlators/features/marker/utils/syncdaemon/gsyncd.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'xlators/features/marker/utils/syncdaemon/gsyncd.py') diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py index d5772013e..a992005ec 100644 --- a/xlators/features/marker/utils/syncdaemon/gsyncd.py +++ b/xlators/features/marker/utils/syncdaemon/gsyncd.py @@ -115,7 +115,12 @@ def startup(**kw): if gconf.log_level: lkw['level'] = gconf.log_level if kw.get('log_file'): - lkw['filename'] = kw['log_file'] + if kw['log_file'] in ('-', '/dev/stderr'): + lkw['stream'] = sys.stderr + elif kw['log_file'] == '/dev/stdout': + lkw['stream'] = sys.stdout + else: + lkw['filename'] = kw['log_file'] GLogger.setup(slave=kw.get('slave'), **lkw) def finalize(*a): @@ -199,8 +204,8 @@ def main_i(): op.add_option('--listen', dest='listen', help=SUPPRESS_HELP, action='callback', callback=store_local_curry(True)) op.add_option('-N', '--no-daemon', dest="go_daemon", action='callback', callback=store_local_curry('dont')) op.add_option('--debug', dest="go_daemon", action='callback', callback=lambda *a: (store_local_curry('dont')(*a), - a[-1].values.__dict__.get('log_level') or \ - a[-1].values.__dict__.update(log_level='DEBUG'))) + setattr(a[-1].values, 'log_file', '-'), + setattr(a[-1].values, 'log_level', 'DEBUG'))), op.add_option('--config-get', metavar='OPT', type=str, dest='config', action='callback', callback=store_local) op.add_option('--config-get-all', dest='config', action='callback', callback=store_local_curry(True)) op.add_option('--config-set', metavar='OPT VAL', type=str, nargs=2, dest='config', action='callback', -- cgit