Open wayne2tech opened 1 month ago
I want to know what happened to this, thanks
Each time Uvicorn starts a new worker, a new process is spawned and the Python script is re-executed.
This means logger.add(sink=log_save_path)
is called multiple times in multiple processes. This is not good, because since different processes are writing concurrently to the same file, this creates conflicts during rotation.
You should make sure the workers are writing to different files, or avoid using a file sink.
the log file:![log](https://github.com/Delgan/loguru/assets/56107092/db0ede6c-2d74-465e-b035-0f4734b6188f)
the code:![image](https://github.com/Delgan/loguru/assets/56107092/0527bfd5-fbb0-4576-9b73-9b8b2c131fce)