-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gunicorn fastapi use loguru #1111
Comments
Yes, this is because of the multiple processes started by FastAPI. They won't inherit the Right now, it's advised to use one unique file per worker, until a new workaround is implemented in Loguru. |
How to do it? Can you give me some ideas? Thank you |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used this command to deploy the fastapi
gunicorn main:app -b 0.0.0.0:12000 -w 4 -k uvicorn.workers.UvicornWorker --daemon
,Logoru was used to record HTTP requests and responses, but I found that some logs were not recorded,my loguru config:logger.add("logs/api.log", encoding="utf-8", catch=True, backtrace=True, diagnose=True, enqueue=True, rotation="00:00", retention="20 days", compression="zip")
,is-w 4
or-k uvicorn.workers.UvicornWorker
has some problems?use
-w 1
,it's likely work fine。The text was updated successfully, but these errors were encountered: