summaryrefslogtreecommitdiff
path: root/obnam
diff options
context:
space:
mode:
authorLars Wirzenius <liw@gytha>2009-06-13 17:39:36 +0300
committerLars Wirzenius <liw@gytha>2009-06-13 17:39:36 +0300
commit2237f6fd279d580be398de6b48d0c0241a6600ca (patch)
tree5f8ac6dd92fb31412c02cd9a1036c84aa56b46fd /obnam
parent2e7a80470becd7200b793d83403c15c7749c9f9b (diff)
downloadobnam-2237f6fd279d580be398de6b48d0c0241a6600ca.tar.gz
Log exceptions fully to logfile and write them nicely to stdout.
Diffstat (limited to 'obnam')
-rwxr-xr-xobnam11
1 files changed, 10 insertions, 1 deletions
diff --git a/obnam b/obnam
index 17aa3f83..d7e75052 100755
--- a/obnam
+++ b/obnam
@@ -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)