summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-03-31 03:29:35 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-31 04:20:03 -0700
commit215a8352e2219c7ead29693ccab3452054a89041 (patch)
tree7b3350b5799dad210ca1ea1d726da49eff5796cb
parente0f03d7430f6b79e9ed0fa68234753e33368e3e6 (diff)
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 <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2637 (gsyncd --debug broken) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2637
-rw-r--r--xlators/features/marker/utils/syncdaemon/gsyncd.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py
index d5772013e49..a992005ecd3 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',