logging TimedRotatingFileHandler不支持多进程
2017-07-20 11:11
1991 查看
python程序中,我们经常会使用logging进行日志打印,logging的多线程支持得很好,但是对于多进程就无能为力了
多个进程同时写一份日志文件会导致TimedRotatingFileHandler日志切割失败,亲测,我的应用场景是:
使用logging打印日志,分别对应xxx.log 和 xxx.log.wf
同时在调用python脚本的shell脚本中将shell脚本日志append 到xxx.log,检查日志切割时发现只有xxx.log.wf日志正确切割,xxx.log并没有切割,网上搜索一番后发现TimedRotatingFileHandler不支持多进程,甚至可能造成日志丢失
多个进程同时写一份日志文件会导致TimedRotatingFileHandler日志切割失败,亲测,我的应用场景是:
使用logging打印日志,分别对应xxx.log 和 xxx.log.wf
同时在调用python脚本的shell脚本中将shell脚本日志append 到xxx.log,检查日志切割时发现只有xxx.log.wf日志正确切割,xxx.log并没有切割,网上搜索一番后发现TimedRotatingFileHandler不支持多进程,甚至可能造成日志丢失
相关文章推荐
- python logging 模块之TimedRotatingFileHandler 实现每天一个日志文件
- Python多进程不要使用TimedRotatingFileHandler
- [bigdata-078] python3 logging 的示例 TimedRotatingFileHandler和RotatingFileHandler 基于时间切分和基于文件大小切分
- python logging现学现用 – TimedRotatingFileHandler使用方法
- TimedRotatingFileHandler
- 实际应用中遇到TimedRotatingFileHandler不滚动的问题
- python日志按时间切分-----TimedRotatingFileHandler
- Python logging RotatingFileHandler bug
- Python logging RotatingFileHandler bug
- python logging类库中RotatingFileHandler的使用
- java.util.logging.FileHandler
- 新版python logging 封装,支持同时向console,file,socket输出
- java.util.logging.FileHandler Handler
- python 多进程 logging:ConcurrentLogHandler
- python 多进程 logging:ConcurrentLogHandler
- Python的RotatingFileHandler的Bug
- Django开发模式会加载两次settings文件导致RotatingFileHandlerError
- windows系统中的浏览器(支持html5的),用html5上传word文件获取到的file.type值为空,ios系统则能获取到
- JAVA错误:could not find class javax.activation.DataHandler from file activation.jar
- Struts2 ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging