Max Arnold <[email protected]> added the comment:
> Why can't you either use %r in the format string, or define your own
handler/formatter to do exactly what you want?
I'm describing default behaviour of logger.exception(). Out of the box
(with SyslogHandler and "/dev/log") I'm unable to use it, because of
this problem.
Can you please explain in more details how I can change my code to
correcly log exceptions? For example:
import logging, logging.handlers
log = logging.getLogger()
h = logging.handlers.SysLogHandler('/dev/log',
logging.handlers.SysLogHandler.LOG_LOCAL0)
h.setFormatter(logging.Formatter('%(name)s: %(levelname)s
%(funcName)s/%(lineno)d %(message)s'))
log.addHandler(h)
try:
a = 1/0
except:
log.exception('division by zero')
----------
status: pending -> open
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue6444>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com