2017-01-05 5 views
1

私は1.3クモスクリプトからScrapyを実行しているを無視していると私は推奨プラクティスScrapyは私のログ設定と印刷DEBUG

私も念のsettings.pyでLOG_LEVELを設定

configure_logging({'LOG_LEVEL': 'INFO'}) 
process = CrawlerProcess() 
process.crawl(MySpider) 
process.start() 
を追っ

LOG_LEVEL = 'WARNING' 

しかし、Scrapyはそれを無視し、DEBUGをログに記録しています。 私はどこにでもログを定義しません。

答えて

2

From the docsのように、CrawlerRunnerの例をCrawlerProcessのように混ぜていると思います。ここCrawlerRunnerための一つです:ドキュメント(あなたLOG_LEVEL設定を含むドキュメントの例)でmentionnedのように、いくつかの設定を渡す必要があるCrawlerProcess()

...  
configure_logging({'LOG_FORMAT': '%(levelname)s: %(message)s'}) 
runner = CrawlerRunner() 

d = runner.crawl(MySpider) 
d.addBoth(lambda _: reactor.stop()) 
reactor.run() # the script will block here until the crawling is finished 

反し:

... 
process = CrawlerProcess({ 
    'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)', 
    'LOG_LEVEL': 'INFO', 
}) 

process.crawl(MySpider) 
process.start() # the script will block here until the crawling is finished 
関連する問題