From 79af90dd6a95c34869f5e3270bb8096f753f2bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 22 Feb 2017 18:25:12 +0100 Subject: [PATCH] Make sure we don't try to use an empty logging.yaml Fixes #1560 --- src/octoprint/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/octoprint/__init__.py b/src/octoprint/__init__.py index ebf1ffbd..065ac99c 100644 --- a/src/octoprint/__init__.py +++ b/src/octoprint/__init__.py @@ -221,6 +221,7 @@ def init_logging(settings, use_logging_file=True, logging_file=None, default_con if verbosity > 2: default_config["root"]["level"] = "DEBUG" + config = default_config if use_logging_file: # further logging configuration from file... if logging_file is None: @@ -233,9 +234,8 @@ def init_logging(settings, use_logging_file=True, logging_file=None, default_con config_from_file = yaml.safe_load(f) # we merge that with the default config - config = dict_merge(default_config, config_from_file) - else: - config = default_config + if config_from_file is not None and isinstance(config_from_file, dict): + config = dict_merge(default_config, config_from_file) # configure logging globally return set_logging_config(config, debug, verbosity, uncaught_logger, uncaught_handler)