DoubleLi

qq: 517712484 wx: ldbgliet

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

使用:   concurrent-log-handler

GITHUB:   https://github.com/Preston-Landers/concurrent-log-handler

安装: pip install concurrent-log-handler

复制代码
import logging
from concurrent_log_handler import ConcurrentRotatingFileHandler

logger = logging.getLogger(__name__)
handler = ConcurrentRotatingFileHandler(filename=log_file, mode="a", maxBytes=10 * 1024, 
                        backupCount=5,encoding='utf-8') logger.addHandler(handler)
复制代码

 

参考文章:python logging模块“另一个程序正在使用此文件,进程无法访问。”问题解决办法-百度网盘下载-Java自学者论坛 - Powered by Discuz! (javazxz.com)

posted on 2024-07-15 11:30  DoubleLi  阅读(9)  评论(0编辑  收藏  举报