You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Yes, this is because of the multiple processes started by FastAPI. They won't inherit the logger, therefore the enqueue=True parameter is unfortunately ineffective.
Right now, it's advised to use one unique file per worker, until a new workaround is implemented in Loguru.
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: