import StringIO
import contextlib
import logging
+import sys
+from traceback import format_tb
+
def config_file(string):
config = {}
handler.setFormatter(formatter)
logging.getLogger().addHandler(handler)
+ install_except_hook()
+
+
+def install_except_hook():
+ def log_exception(exception_class, exception, traceback):
+ logging.critical(''.join(format_tb(traceback)))
+ logging.critical('{0}: {1}'.format(exception_class, exception))
+
+ sys.excepthook = log_exception
+
+
def write_initial_metadata(ctx):
if ctx.archive is not None:
with file(os.path.join(ctx.archive, 'pid'), 'w') as f: