errbotio / errbot

Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.
http://errbot.io
GNU General Public License v3.0
3.12k stars 612 forks source link

Incorrect log levels showing for werkzeug #1555

Closed AshleyJackson closed 2 years ago

AshleyJackson commented 2 years ago

Describe the bug When I have configured the Log Level to "WARNING", werkzeug always outputs the Webserver logs as in "INFO" to the console. BOT_LOG_LEVEL = logging.WARNING

To Reproduce

@webhook('/health_check/')
def health_check(self, request):
    self.log.debug(repr(request))
    pass

Enable the Webserver in Errbot and build a webhook using the above code.

Expected behavior Zero console logging under the INFO level when config level is set to WARNING

Screenshots image

Environment (please complete the following information):

AshleyJackson commented 2 years ago

TIL: Submodules can have their own logging, that sometimes doesn't listen to Root logging configurations.

I fixed this with the below code at the beginning of config.py

WERKZEUG_LOGGER = logging.getLogger('werkzeug')
BOT_LOG_LEVEL = logging.WARNING
WERKZEUG_LOGGER.setLevel(BOT_LOG_LEVEL)