From 8168cd3ab34720ca07cd7782e72ce2185279c4e5 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 13 Feb 2021 15:13:07 +0100 Subject: [PATCH] Don't default on logging.INFO level if another level is set in the configuration, and apply the same logging level also to the web server [closes #162] --- platypush/__init__.py | 1 - platypush/backend/http/app/__init__.py | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/platypush/__init__.py b/platypush/__init__.py index 31fc0b079..ca4daea88 100644 --- a/platypush/__init__.py +++ b/platypush/__init__.py @@ -27,7 +27,6 @@ __author__ = 'Fabio Manganiello ' __version__ = '0.13.9' logger = logging.getLogger('platypush') -logger.setLevel(logging.INFO) class Daemon: diff --git a/platypush/backend/http/app/__init__.py b/platypush/backend/http/app/__init__.py index b3cb22c56..d7762f160 100644 --- a/platypush/backend/http/app/__init__.py +++ b/platypush/backend/http/app/__init__.py @@ -1,12 +1,23 @@ +import logging import os from flask import Flask +from platypush import Config from platypush.backend.http.app.utils import get_routes +def initialize_logger(): + logger = logging.getLogger('werkzeug') + log_conf = Config.get('logging') + if 'level' in log_conf: + logger.setLevel(log_conf['level']) + + ## Webapp initialization +initialize_logger() + base_folder = os.path.abspath(os.path.join( os.path.dirname(os.path.abspath(__file__)), '..'))