Recording exceptions on the server
Jonathan Lange
jml at mumak.net
Tue Jul 7 04:07:25 BST 2009
I'd like to hook into Bazaar so that any errors raised by the smart
server get logged in our internal OOPS error handling system.
For many Python applications, the natural way to do this would be to
add Handler to a Logger object so that any exception() calls get
turned into OOPS reports.
Bazaar half-uses Python's 'logging' module. bzrlib uses bzrlib.trace,
which sometimes uses logging and other times does direct file access.
As best as I can tell, I think I want to record an OOPS every time
log_exception_quietly is called.
log_exception_quietly calls mutter(traceback.format_exc()). This is
*almost* the same as _bzr_logger.exception(), except that mutter is
quieter. exception() would also log an actual error.
I'd like log_exception_quietly to Python logging, but I don't see how
to make it work -- any ideas?
To address my immediate problem, I'm going to monkey-patch
log_exception_quietly to directly call our OOPS system.
Thanks,
jml
More information about the bazaar
mailing list