logging exceptions

Alexandru Mosoi brtzsnr at gmail.com
Tue Aug 26 05:36:45 EDT 2008


why doesn't logging throw any exception when it should? how do I
configure logging to throw exceptions?

>>> try:
...   logging.fatal('asdf %d', '123')
... except:
...   print 'this line is never printed'
...
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/logging/__init__.py", line 744, in emit
    msg = self.format(record)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/logging/__init__.py", line 630, in format
    return fmt.format(record)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/logging/__init__.py", line 418, in format
    record.message = record.getMessage()
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/logging/__init__.py", line 288, in getMessage
    msg = msg % self.args
TypeError: int argument required



More information about the Python-list mailing list