diff options
author | Lars Wirzenius <liw@gytha> | 2009-06-13 17:39:36 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@gytha> | 2009-06-13 17:39:36 +0300 |
commit | 2237f6fd279d580be398de6b48d0c0241a6600ca (patch) | |
tree | 5f8ac6dd92fb31412c02cd9a1036c84aa56b46fd /obnam | |
parent | 2e7a80470becd7200b793d83403c15c7749c9f9b (diff) | |
download | obnam-2237f6fd279d580be398de6b48d0c0241a6600ca.tar.gz |
Log exceptions fully to logfile and write them nicely to stdout.
Diffstat (limited to 'obnam')
-rwxr-xr-x | obnam | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -16,7 +16,10 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import logging import os +import sys +import traceback import obnamlib @@ -26,4 +29,10 @@ if "OBNAM_PROFILE" in os.environ: cProfile.run('obnamlib.BackupApplication().run()', os.environ["OBNAM_PROFILE"]) else: - obnamlib.BackupApplication().run() + try: + obnamlib.BackupApplication().run() + except Exception, e: + logging.debug(traceback.format_exc()) + logging.error(str(e)) + sys.stdout.write("ERROR: %s\n" % str(e)) + sys.exit(1) |