summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2')
-rw-r--r--src/lib/Bcfg2/Logger.py15
-rw-r--r--src/lib/Bcfg2/Server/Core.py5
2 files changed, 14 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Logger.py b/src/lib/Bcfg2/Logger.py
index 8f7bb14f8..5bbc9ff96 100644
--- a/src/lib/Bcfg2/Logger.py
+++ b/src/lib/Bcfg2/Logger.py
@@ -143,7 +143,10 @@ def add_console_handler(level=logging.DEBUG):
console.setLevel(level)
# tell the handler to use this format
console.setFormatter(TermiosFormatter())
- console.set_name("console")
+ try:
+ console.set_name("console")
+ except AttributeError:
+ console.name = "console"
logging.root.addHandler(console)
@@ -158,7 +161,10 @@ def add_syslog_handler(procname, syslog_facility, level=logging.DEBUG):
syslog = FragmentingSysLogHandler(procname,
('localhost', 514),
syslog_facility)
- syslog.set_name("syslog")
+ try:
+ syslog.set_name("syslog")
+ except AttributeError:
+ syslog.name = "syslog"
syslog.setLevel(level)
syslog.setFormatter(
logging.Formatter('%(name)s[%(process)d]: %(message)s'))
@@ -172,7 +178,10 @@ def add_syslog_handler(procname, syslog_facility, level=logging.DEBUG):
def add_file_handler(to_file, level=logging.DEBUG):
"""Add a logging handler that logs to to_file."""
filelog = logging.FileHandler(to_file)
- filelog.set_name("file")
+ try:
+ filelog.set_name("file")
+ except AttributeError:
+ filelog.name = "file"
filelog.setLevel(level)
filelog.setFormatter(
logging.Formatter('%(asctime)s %(name)s[%(process)d]: %(message)s'))
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index ff6cbb14b..382f11e50 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -1232,10 +1232,9 @@ class BaseCore(object):
self.logger.info("Core: debug = %s" % debug)
levels = self._loglevels[self.debug_flag]
for handler in logging.root.handlers:
- level = levels.get(handler.get_name(), levels['default'])
+ level = levels.get(handler.name, levels['default'])
self.logger.debug("Setting %s log handler to %s" %
- (handler.get_name(),
- logging.getLevelName(level)))
+ (handler.name, logging.getLevelName(level)))
handler.setLevel(level)
return self.debug_flag