From f7e058d3871e798953eb02708e526c84dc0430cf Mon Sep 17 00:00:00 2001 From: Brain Date: Wed, 26 Jan 2022 23:34:38 +0100 Subject: [PATCH] Get rid of more duplicate logging --- app.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.py b/app.py index 3ef2a67..657ded5 100644 --- a/app.py +++ b/app.py @@ -8,7 +8,6 @@ import os from dotenv import load_dotenv, find_dotenv from flask import Flask from flask_cors import CORS -from flask.logging import default_handler from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy from ldap3.utils.log import logger as ldap3_logger @@ -17,14 +16,15 @@ from ldap3.utils.log import set_library_log_detail_level, BASIC load_dotenv(find_dotenv()) app = Flask(__name__) + +# Configure logging loglevel = os.getenv("KI_LOGLEVEL", logging.WARNING) loglevel = int(loglevel) app.logger.setLevel(loglevel) app.logger.propagate = False # do not forward messages to the root logger logging.basicConfig(level=loglevel, format='[%(asctime)s] %(levelname)s [%(name)s] %(message)s') # configure root logger as fallback - -set_library_log_detail_level(BASIC) -ldap3_logger.addHandler(default_handler) +logging.getLogger('werkzeug').propagate = False # werkzeug has its own ColorStreamHandler +set_library_log_detail_level(BASIC) # ldap3 has different verbosity levels internally app.config["SQLALCHEMY_DATABASE_URI"] = os.getenv("SQLALCHEMY_DATABASE_URI") app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False