How to get logger.info of Flask app in Waitress in windows?

Viewed 614

I have the flask app serving in waitress in windows, I have logger info

app = Flask(__name__)
logging.basicConfig(level=logging.ERROR)

@app.route('/run', methods=['POST'])
def RunFunction():
    …………codes...……..
    app.logger.info("Log 1: Starting App on Port: {}".format(LISTEN_PORT))
    …………...

If I run with flask, I get the logger info

if __name__ == '__main__':   
    app.run(debug=True,port=8080, threaded=True,use_reloader=False)

If I use in waitress

from waitress import serve
serve(app, host='0.0.0.0', threads=WAITRESS_THREADS, port=LISTEN_PORT)

I am not getting logger info in console

I tried

app = Flask(__name__)
logger = logging.getLogger('waitress')
logger.setLevel(logging.ERROR)

and logger codes as

logger.info("Log 1: Starting App on Port: {}".format(LISTEN_PORT))

This is not working

Also I tried

from paste.translogger import TransLogger 
serve(TransLogger(app, setup_console_handler=True), host='0.0.0.0', threads=WAITRESS_THREADS, port=LISTEN_PORT)

This also not working, may I know how to get the logger info in waitress

0 Answers
Related