From 61a08299b836011c03d4929e6ca96c9e8547bd4e Mon Sep 17 00:00:00 2001 From: Peter Surda Date: Mon, 29 Aug 2016 11:56:21 +0800 Subject: [PATCH] Less confusing message when logger config missing - if the logger config is missing, don't print unnecessary stack trace - partially addresses #893 --- src/debug.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/debug.py b/src/debug.py index 707d7062..606308a0 100644 --- a/src/debug.py +++ b/src/debug.py @@ -38,10 +38,14 @@ def configureLogging(): try: logging.config.fileConfig(os.path.join (shared.appdata, 'logging.dat')) have_logging = True - print "Loaded debug config from %s" % (os.path.join(shared.appdata, 'logging.dat')) + print "Loaded logger configuration from %s" % (os.path.join(shared.appdata, 'logging.dat')) except: - print "Failed to load debug config from %s, using default logging config" % (os.path.join(shared.appdata, 'logging.dat')) - print sys.exc_info() + if os.path.isfile(os.path.join(shared.appdata, 'logging.dat')): + print "Failed to load logger configuration from %s, using default logging config" % (os.path.join(shared.appdata, 'logging.dat')) + print sys.exc_info() + else: + # no need to confuse the user if the logger config is missing entirely + print "Using default logger configuration" sys.excepthook = log_uncaught_exceptions