-
Notifications
You must be signed in to change notification settings - Fork 673
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
Access Log Files Upon Rotation #1102
Comments
Hey @irisk29. It's likely an issue with the different process workers invoked by FastAPI. Each time a worker is spawned, the There is no built-in solution for that issue yet. Ideally, we would need to use The safe solution for now it to use one different file per worker. |
Hello,
I'm trying to implement a simple use case where I log into the stdout and into a file in a FastApi application.
The following code:
creates a log file, but after 30 seconds, when it is time to rotate the file and rename the old one with a date in its name, I encounter with
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process out-1.log -> out-1.2024-03-14_21-49-52_733426.log
but if I define the file name like this:
the access and rotation works just fine (although it creates 2 files on startup instead of one)
What am I doing wrong?
The text was updated successfully, but these errors were encountered: