-
I have a very simple Quart app that I use for some local home automation. I'd like to log the default Quart requests to a file instead of the console/stdout. When the app starts and a request is made (
I would like to be able to console log the last two lines (info about the request) to a log file. Despite many attempts to do so, I can never it to work. The closest I have gotten is with this code: hypercorn_logger = logging.getLogger('hypercorn')
hypercorn_logger.addHandler(logging.FileHandler('test.log', 'w')) However, it only logs this line to the file: Demo App Codeimport logging
from quart import Quart
app = Quart(__name__)
@app.route('/info')
async def info():
return "here's some info"
if __name__ == '__main__':
app.run(host='0.0.0.0') Versions:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The easiest way if you use Hypercorn is to set the |
Beta Was this translation helpful? Give feedback.
The reason is that when you use the development server with
app.run()
Quart overrides the Hypercorn config.You can either use Hypercorn directly (like described here), or do this: