I have set up a Python Django projects. I have made a number of web services. But sometimes the data being logged is somewhat large and it takes like 3-4 seconds to log due to which response of service is delayed for few seconds which is a big factor in terms of performance.
Question: I was just wondering how can I make logging kind of asynchronous? Does Django provide like an option for this? OR do I have to take some other approach and handle it myself like open another thread and do logging in it?
You can use QueueHandler
amd QueueListener
which are available for Python 2.x through the logutils
package. This post has more details, as do the relevant Python 3.x docs .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.