Less confusing message when logger config missing

- if the logger config is missing, don't print unnecessary stack trace
- partially addresses #893
This commit is contained in:
Peter Šurda 2016-08-29 11:56:21 +08:00
parent dadc3b9057
commit 61a08299b8
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -38,10 +38,14 @@ def configureLogging():
try: try:
logging.config.fileConfig(os.path.join (shared.appdata, 'logging.dat')) logging.config.fileConfig(os.path.join (shared.appdata, 'logging.dat'))
have_logging = True 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: except:
print "Failed to load debug config from %s, using default logging config" % (os.path.join(shared.appdata, 'logging.dat')) 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() 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 sys.excepthook = log_uncaught_exceptions