python - Flask Logging - Debug setting -


i using following config flask app:

class stagingconfig(config):     debug = false     mongo_db_name = "res_stage_database"      @classmethod     def init_app(cls, app):         import logging         logging.handlers import rotatingfilehandler         rotating_handler = rotatingfilehandler(filename='gunicorn.out', maxbytes=10000000, backupcount=5)         rotating_handler.setlevel(logging.info)         formatter = logging.formatter("%(asctime)s - %(levelname)s - %(message)s")         rotating_handler.setformatter(formatter)         app.logger.addhandler(rotating_handler)         app.logger.info("using stagingconfig")         app.logger.error("using stagingconfig") 

(above, appends error message gunicorn.out- 2015-04-26 18:03:38,182 - error - using stagingconfig )

since config used in staged app, want debug false, dont flask debug screens in case of errors, , instead standard error 500 screen. although reason, when debug set false, logging of error messages except error stops.

as debug set true, logging occurs correctly. shouldn't these values independent, since set log level on logging handler?

turns out had use app.logger.setlevel(logging.info), instead of setting level on handler.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -