Another reason you can change the log output is to test and redirect server logs to a log file.
I could not get the above sentence to work, it seems that the loggers are configured as part of the application launch. I managed to get it working by changing the log levels after starting the application:
... (in setUpClass) server = Thread(target=lambda: app.run(host=hostname, port=port, threaded=True)) server.daemon = True server.start() wait_for_boot(hostname, port)
Unfortunately, * Running on localhost:9151 and the first health check are still printed at the standard level, but when a large number of tests are run, it clears the output per ton.
“So why log_names ?” You ask. In my case, there were some additional magazines that I needed to get rid of. I was able to find which loggers to add to log_names using:
from flask import Flask app = Flask(__name__) import logging print(logging.Logger.manager.loggerDict)
Side note: It would be nice if there was flaskapp.getLogger () or something else, so it was more reliable for versions. Any ideas?
A few more keywords: check box log deletes stdout output
thanks to:
daicoden Oct 12 '16 at 2:29 2016-10-12 02:29
source share