Commit ae5b407e authored by Jérome Perrin's avatar Jérome Perrin

proxy: don't set app logger level

logging is configured globally in SlapOSApp.configure_logging and:
 - if logging to file is enabled, it is logged with maximum level
 - logging on the console depends on --quiet / --verbose command line flags

Default log level of this logger was DEBUG, which is just fine: the logger
emit all messages and the file/console handler decide to output them or not

Because we configure logger after Flask initialize its own logging, for
Flask >= 1.1.2, we remove Flask logger as described in
 https://flask.palletsprojects.com/en/1.1.x/logging/#removing-the-default-handler
Since this is internal API which doest not exist on old version of Flask, we
adjust requirements to require a recent version of Flask.
parent 0cc0c34f
......@@ -58,7 +58,7 @@ setup(name=name,
packages=find_packages(),
include_package_data=True,
install_requires=[
'Flask', # used by proxy
'Flask>=1.1.2', # used by proxy
'lxml', # needed to play with XML trees
'netaddr>=0.7.5', # to play safely with IPv6 prefixes
'netifaces', # to fetch information about network devices
......
......@@ -102,7 +102,10 @@ def connectDB():
def do_proxy(conf):
for handler in conf.logger.handlers:
app.logger.addHandler(handler)
app.logger.setLevel(logging.INFO)
from flask.logging import default_handler
app.logger.removeHandler(default_handler)
setupFlaskConfiguration(conf)
connectDB()
app.run(host=conf.host, port=int(conf.port), threaded=True)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment