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

Use errbot log level with webserver for consistent logging #1556

Closed nzlosh closed 2 years ago

nzlosh commented 2 years ago

This patch will take errbot's log level configuration and pass it to werkzeug for consistent logging.

fixes #1555

sijis commented 2 years ago

@nzlosh Do you think this is still necessary after the workaround given in #1555 ?

nzlosh commented 2 years ago

Either we handle logging consistently in the core or we clearly document this workaround in the official documentation. I'm inclined to go with this patch since it's more obvious how logging is controlled.

I did wonder if people might want access logs (INFO level for werkzeug) but less verbose logging for errbot. If someone does create a request for such a feature, I think it'd make sense to split out werkzeug log level and log entries into a separate log file and create new variables WEBSERVER_LOG_FILE and WEBSERVER_LOG_LEVEL.

This would also encapsulate the webserver implementation details and avoid breaking configuration if we switch to a different webserver in the future.

AshleyJackson commented 2 years ago

In my implementation I use other modules that have their own logging (outside of werkzeug) that still send to console, even if the configuration is set correctly.

If there is an option for the Root configuration to take precedence over sub-modules, I believe that that would be beneficial for nearly everyone who relies on the log outputs for Errbot.

If logging is required, developers can create their own log output where necessary using self.log.*(msg) IMO.

nzlosh commented 2 years ago

Errbot should not be attempting to override logging in other peoples code as there is no reasonable to way to know if it is required for the use case. User code will need to handle logging based on their needs. They have access to self.bot_config.BOT_LOG_LEVEL if they want to set the log level for their loggers to be the same as errbot's configuration.