Skip to content

Instantly share code, notes, and snippets.

@wuub
Created August 30, 2012 13:58
Show Gist options
  • Save wuub/3529097 to your computer and use it in GitHub Desktop.
Save wuub/3529097 to your computer and use it in GitHub Desktop.
Trace an error in logging.xxx()
import logging.handlers
def emit(self, record):
"""
Emit a record.
Output the record to the file, catering for rollover as described
in doRollover().
"""
try:
if self.shouldRollover(record):
self.doRollover()
logging.FileHandler.emit(self, record)
except (KeyboardInterrupt, SystemExit):
raise
except:
import pdb; pdb.set_trace()
self.handleError(record)
logging.handlers.BaseRotatingHandler.emit = emit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment