-
Notifications
You must be signed in to change notification settings - Fork 1
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
【坑】logging的坑 #17
Comments
使用TimedRotatingFileHandler 必须加的:
|
重写 TimedRotatingFileHandler 类,让logging支持多进程日志记录 |
python logging日志模块以及多进程日志:https://www.jianshu.com/p/d615bf01e37b |
TimedRotatingFileHandler 是 Python 提供的一个可以基于时间自动切分日志的 Handler 类,他继承自 BaseRotatingHandler -> logging.FileHandler 但是他有一个缺点就是没有办法支持多进程的日志切换,多进程进行日志切换的时候可能会因为重命名而丢失日志数据。 来看下他的实现(我默认大家已经知道了 FileHandler 的实现和 logging 模块的调用机制 如果还不清楚可以先去看下我前面那篇文章 https://www.cnblogs.com/piperck/p/9634133.html): |
Python 日志logging模块初探及多线程踩坑(2) https://blog.csdn.net/qq_41603102/article/details/90200692 |
Python 日志模块 logging rotate 的坑儿:https://www.jianshu.com/p/25f70905ae9d
The text was updated successfully, but these errors were encountered: