diff --git a/redash/__init__.py b/redash/__init__.py index 5ef03404..ecc6a777 100644 --- a/redash/__init__.py +++ b/redash/__init__.py @@ -20,8 +20,7 @@ def setup_logging(): logging.getLogger().addHandler(handler) logging.getLogger().setLevel(settings.LOG_LEVEL) - if settings.EVENTS_LOG_PATH: - events.setup_logging(settings.EVENTS_LOG_PATH, settings.EVENTS_CONSOLE_OUTPUT) + events.setup_logging(settings.EVENTS_LOG_PATH, settings.EVENTS_CONSOLE_OUTPUT) setup_logging() diff --git a/redash/events.py b/redash/events.py index c7c996d9..feef260b 100644 --- a/redash/events.py +++ b/redash/events.py @@ -6,10 +6,11 @@ logger.propagate = False def setup_logging(log_path, console_output=False): - fh = logging.FileHandler(log_path) - formatter = logging.Formatter('%(message)s') - fh.setFormatter(formatter) - logger.addHandler(fh) + if log_path: + fh = logging.FileHandler(log_path) + formatter = logging.Formatter('%(message)s') + fh.setFormatter(formatter) + logger.addHandler(fh) if console_output: handler = logging.StreamHandler()