This content originally appeared on DEV Community and was authored by drake
- 样例
2025-03-20 10:58:40,853 - Extension - INFO - Coingecko_liquidity Idle 爬虫上次启动时间为 2025-03-20 10:58:27
2025-03-20 10:58:40 [Extension] INFO: Coingecko_liquidity Idle 爬虫上次启动时间为 2025-03-20 10:58:27
代码中只打印了一次,但是实际运行程序会打印两次
- 在settings文件中加一行配置
# 禁用默认日志捕获,防止重复的日志打印
LOG_ENABLED = False
该配置不会忽略所有的日志打印,该正常打印的信息,都还是会打印的,只是不会重复打印了;
解决了重复打印的问题
This content originally appeared on DEV Community and was authored by drake

drake | Sciencx (2025-03-20T03:19:25+00:00) scrapy自定义的extension日志被打印两次的问题. Retrieved from https://www.scien.cx/2025/03/20/scrapy%e8%87%aa%e5%ae%9a%e4%b9%89%e7%9a%84extension%e6%97%a5%e5%bf%97%e8%a2%ab%e6%89%93%e5%8d%b0%e4%b8%a4%e6%ac%a1%e7%9a%84%e9%97%ae%e9%a2%98/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.