使用日志记录的Python程序进入睡眠模式3小时

2024-04-28 07:03:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用python日志模块,进程突然进入睡眠模式3个小时。可能的原因是什么?与日志记录相关的代码如下

1.2倍

logger = logging.getLogger(__name__)
logger.info("foo")

a2.2倍

logger = logging.getLogger(__name__)
logger.info("bar")

主.py

logging.basicConfig(filename=str(final_log_file), format=head)

logger = logging.getLogger()

logger.setLevel(logging.INFO)

console = logging.StreamHandler() # <--- comment it and error goes away

logging.getLogger('').addHandler(console)  # <--- comment it and error goes away

Tags: 模块andnameinfo进程logging模式comment