diff options
author | Csaba Henk <csaba@gluster.com> | 2011-03-10 00:40:38 +0000 |
---|---|---|
committer | Vijay Bellur <vijay@dev.gluster.com> | 2011-03-10 07:39:29 -0800 |
commit | fa04a42cc5b9f187ea169b26cc60ee25ac8a3c31 (patch) | |
tree | 42a2c06910a7df9f9a6fb7460f167bebd3a7535b /xlators/features | |
parent | f2dd7abbf1af9832c891e6edadba696cefbccbe1 (diff) |
syncdaemon: improve loglevel handling
Signed-off-by: Kaushik BV <kaushikbv@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1570 (geosync related changes)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
Diffstat (limited to 'xlators/features')
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/gsyncd.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py index 331fda34fe2..43e3dfacee0 100644 --- a/xlators/features/marker/utils/syncdaemon/gsyncd.py +++ b/xlators/features/marker/utils/syncdaemon/gsyncd.py @@ -45,9 +45,7 @@ class GLogger(Logger): '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): - lvl = logging.getLevelName(lvl) - lprm['level'] = lvl + lprm['level'] = lvl logging.root = cls("root", lvl) logging.setLoggerClass(cls) logging.getLogger().handlers = [] @@ -280,6 +278,17 @@ def main_i(): gcnf.update_to(gconf.__dict__) gconf.__dict__.update(opts.__dict__) + #normalize loglevel + lvl0 = gconf.log_level + if isinstance(lvl0, str): + lvl1 = lvl0.upper() + lvl2 = logging.getLevelName(lvl1) + # I have _never_ _ever_ seen such an utterly braindead + # error condition + if lvl2 == "Level " + lvl1: + raise RuntimeError('cannot recognize log level "%s"' % lvl0) + gconf.log_level = lvl2 + go_daemon = rconf['go_daemon'] if isinstance(remote, resource.SSH) and go_daemon == 'should': |