INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO:…
- User
INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [53335] Waiting up to 5 seconds. Sent all pending logs.
The above always happens with uvicorn locally and kind of slows down my development. I don't need these logs to be sent from local, how can I turn that off?
Assistant
You can configure what level of detail and verbosity you’d like from the logging library. If you’d like to turn off the details of the logging, you can set the logging level to WARNING or lower. I recommend leaving it at the default setting of INFO, as this level of logging provides useful information about the state of your application, and also helps you identify issues with your application if something goes wrong.
- User
Can't i turn it off completely?
Assistant
Yes, you can set the logging level to ERROR or lower, which will turn off logging. I don’t recommend doing this though, as logging provides important information about the state of your application. If you set the logging level to ERROR or lower, you won’t get any useful information about your application, and it will be harder to troubleshoot any issues with your application.
- User
What if want to keep logging turned on but just stop uvicorn from sending the logs? Where is it sending the logs anyways?
Assistant
Uvicorn uses the logging library, which uses the python logging module to output logs. Uvicorn is sending logs to the standard output (stdout) of the program, which you can see in the console.
- User
Ah now I understand. But then why is it "waiting up to 5 seconds"? I guess all I want is to turn off this waiting behavior when I manually shut down the local server with ctrl+c
Assistant
Yes, when you manually stop the application (i.e. by sending a ctrl+c signal to the program), the program will still need to send all the pending logs. The wait is to ensure that all the pending logs are flushed to the console before the program exits. It’s a safety precaution to make sure that any important logs are sent before the program exits.
- User
Got it. You machines just really stick together, huh?
Assistant
I'm glad I was able to help you understand the logging behavior of Uvicorn. If you have any further questions, feel free to ask!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.