鍍金池/ 問答/人工智能  Python/ scrapy 明明在settings中設置 'INFO',但用CrawlerPr

scrapy 明明在settings中設置 'INFO',但用CrawlerProcess運行的時候,為什么是DEBUG?

我在scrapy的settings中設置了LOG_LEVEL = 'INFO',但我用CrawlerProcess將多個項目在一個進程中運行的時候,日志顯示為DEBUG,這是為什么?'INFO'比較省些資源吧?
用的是官網(wǎng)的第一個案例,
clipboard.png
類似這樣,再運行該文件。

回答
編輯回答
有點壞

把DEBUG的包 比如urllib3,根據(jù)這個改
logging.getLogger("urllib3").setLevel(logging.WARNING)

2017年9月26日 13:59
編輯回答
舊城人

請加載設置


from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings

process = CrawlerProcess(get_project_settings()) #加載項目設置

# 'followall' 是爬蟲項目中的爬蟲示例
process.crawl('followall', domain='scrapinghub.com')
process.start() # the script will block here until the crawling is finished

https://doc.scrapy.org/en/lat...


這個代碼示例是展示直接運行爬蟲,運行爬蟲項目需加載項目設置

2017年9月23日 20:08