From 5832bc68d54f8fba7f933315b604bc7aa57e9ae4 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 31fc0b079f..ca4daea88b 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 2f8d8cfe58..9eab923fc3 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__)), '..'))