diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-11-27 11:38:32 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-11-27 12:12:34 -0500 |
commit | b4c56a7f20656418ba708847c097f39605ccbb7a (patch) | |
tree | 8e5c24c9079213c26ece816cffabe9436bbb590a /src | |
parent | 0491d5d4e9bc0dc0b7a9ba8c1696ff825ef804ff (diff) | |
download | bcfg2-b4c56a7f20656418ba708847c097f39605ccbb7a.tar.gz bcfg2-b4c56a7f20656418ba708847c097f39605ccbb7a.tar.bz2 bcfg2-b4c56a7f20656418ba708847c097f39605ccbb7a.zip |
produce debug logs about how logging is configured
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Bcfg2/Logger.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Logger.py b/src/lib/Bcfg2/Logger.py index a06d6e79e..24028f71c 100644 --- a/src/lib/Bcfg2/Logger.py +++ b/src/lib/Bcfg2/Logger.py @@ -158,7 +158,7 @@ def add_syslog_handler(procname, syslog_facility, level=logging.DEBUG): logging.Formatter('%(name)s[%(process)d]: %(message)s')) logging.root.addHandler(syslog) except socket.error: - logging.root.error("failed to activate syslogging") + logging.root.error("Failed to activate syslogging") except: print("Failed to activate syslogging") @@ -178,17 +178,22 @@ def setup_logging(procname, to_console=True, to_syslog=True, if hasattr(logging, 'already_setup'): return + params = [] + if to_console: if to_console == True: - clvl = min(logging.WARNING, level) - else: - clvl = min(to_console, level) + to_console = logging.WARNING + clvl = min(to_console, level) + params.append("%s to console" % logging.getLevelName(clvl)) add_console_handler(clvl) if to_syslog: slvl = min(level, logging.INFO) + params.append("%s to syslog" % logging.getLevelName(slvl)) add_syslog_handler(procname, syslog_facility, level=slvl) if to_file is not None: + params.append("%s to %s" % (logging.getLevelName(level), to_file)) add_file_handler(to_file, level=level) logging.root.setLevel(logging.DEBUG) + logging.root.debug("Configured logging: %s" % "; ".join(params)) logging.already_setup = True |