django log问题

来源:互联网 发布:mac win10镜像免激活 编辑:程序博客网 时间:2024/06/07 01:28

服务器端采用nginx + uwsgi + django 部署,log采用按天切割的方式,'when': 'MIDNIGHT'。之前一直没有在意,最近要分析log,发现log总是两个文件一起写(1、elapse.log ;2、elapse.log.日期),而且之前的旧文件内容会被覆盖。

这个问题困扰了一天多,后来在网上发现一段描述:

Although logging is thread-safe, and logging to a single file from multiple threads in a single process is supported, logging to a single file from multiple processes is not supported, because there is no standard way to serialize access to a single file across multiple processes in Python.

在https://github.com/kieslee/mlogging  上有个mlogging  包:


使用方法见   Python多进程记录日志

0 0
原创粉丝点击