if string.find(self._fmt, '%(asctime)') >= 0:
    record.asctime = self.formatTime(record, self.datefmt)
s = self._fmt % record.__dict__
if record.exc_info:
    if not record.exc_text:
        record.exc_text = self.formatException(record.exc_info)
if record.exc_text:
    if s[-1:] != '\n':
        s = s + '\n'
s = s + record.exc_text
return s
Python logging: how to represent newlines in the format string in a logging config file?