Skip to content
Discussion options

You must be logged in to vote

You can use pythons logging module to setup a logger that logs to specific file (https://docs.python.org/3/howto/logging.html#logging-basic-tutorial)

Once you have the above logger you can pass the config (file or dict) to gunicorn using https://docs.gunicorn.org/en/stable/settings.html#logconfig

Once you have your custom logger you can log to it using a custom route/ APIRoute class https://fastapi.tiangolo.com/advanced/custom-request-and-route/?h=logging#custom-request-and-apiroute-class

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
2 participants
Converted from issue

This discussion was converted from issue #4464 on February 27, 2023 22:16.