diff options
author | Sol Jerome <sol.jerome@gmail.com> | 2011-05-10 08:55:53 -0500 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2011-06-14 12:36:45 -0500 |
commit | e6383bdb7d19729d340565fb091a8b67831a5835 (patch) | |
tree | 38f0e698a1fd3cbeda2ff9c289800e8c59344876 | |
parent | ffce8cbd14a0ddc2cd266d80d63b36a786c08cb0 (diff) | |
download | bcfg2-e6383bdb7d19729d340565fb091a8b67831a5835.tar.gz bcfg2-e6383bdb7d19729d340565fb091a8b67831a5835.tar.bz2 bcfg2-e6383bdb7d19729d340565fb091a8b67831a5835.zip |
Logger: Fix non-string logging
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
-rw-r--r-- | src/lib/Logger.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/lib/Logger.py b/src/lib/Logger.py index 8920ba747..9fe81f47e 100644 --- a/src/lib/Logger.py +++ b/src/lib/Logger.py @@ -118,16 +118,19 @@ class FragmentingSysLogHandler(logging.handlers.SysLogHandler): def emit(self, record): """Chunk and deliver records.""" record.name = self.procname - msgs = [] - error = record.exc_info - record.exc_info = None - msgdata = record.msg - while msgdata: - newrec = copy.deepcopy(record) - newrec.msg = msgdata[:250] - msgs.append(newrec) - msgdata = msgdata[250:] - msgs[0].exc_info = error + if isinstance(record.msg, str): + msgs = [] + error = record.exc_info + record.exc_info = None + msgdata = record.msg + while msgdata: + newrec = copy.deepcopy(record) + newrec.msg = msgdata[:250] + msgs.append(newrec) + msgdata = msgdata[250:] + msgs[0].exc_info = error + else: + msgs = [record] for newrec in msgs: msg = self.log_format_string % (self.encodePriority(self.facility, newrec.levelname.lower()), |