[mod] production mode: make sure to set the log level to WARNING

set:
* the root logger level to WARNING
* the werkzeug logger level to WARNING (useful when there is no uwsgi)
This commit is contained in:
Alexandre Flament 2021-09-08 08:44:40 +02:00
parent 0e42db9da1
commit 6abc37efc7
1 changed files with 4 additions and 1 deletions

View File

@ -18,6 +18,7 @@ LOG_FORMAT_DEBUG = '%(levelname)-7s %(name)-30.30s: %(message)s'
# Production # Production
LOG_FORMAT_PROD = '%(asctime)-15s %(levelname)s:%(name)s: %(message)s' LOG_FORMAT_PROD = '%(asctime)-15s %(levelname)s:%(name)s: %(message)s'
LOG_LEVEL_PROD = logging.WARNING
searx_dir = abspath(dirname(__file__)) searx_dir = abspath(dirname(__file__))
searx_parent_dir = abspath(dirname(dirname(__file__))) searx_parent_dir = abspath(dirname(dirname(__file__)))
@ -95,7 +96,9 @@ searx_debug = settings['general']['debug']
if searx_debug: if searx_debug:
logging_config_debug() logging_config_debug()
else: else:
logging.basicConfig(level=logging.WARNING, format=LOG_FORMAT_PROD) logging.basicConfig(level=LOG_LEVEL_PROD, format=LOG_FORMAT_PROD)
logging.root.setLevel(level=LOG_LEVEL_PROD)
logging.getLogger('werkzeug').setLevel(level=LOG_LEVEL_PROD)
logger = logging.getLogger('searx') logger = logging.getLogger('searx')
logger.info(settings_load_message) logger.info(settings_load_message)