Scrapy: how to disable or change log?

好久不见. 提交于 2020-12-01 08:39:57

问题


I've followed the official tutoral of Scrapy, it's wonderful!

I'd like to remove all of DEBUG messages from console output. Is there a way?

2013-06-08 14:51:48+0000 [scrapy] DEBUG: Telnet console listening on 0.0.0.0:6029
2013-06-08 14:51:48+0000 [scrapy] DEBUG: Web service listening on 0.0.0.0:6086

The doc told about to set a LOG_LEVEL, but ... in which file ?

Replying, please make referring to this directory structure. It's the mine. Plus, I've a 'test.py' in spyder folder

tutorial/
    scrapy.cfg
    tutorial/
        __init__.py
        items.py
        pipelines.py
        settings.py
        spiders/
            __init__.py
            ...

Where. in which file, and HOW must i set the log_level ?


回答1:


You need to add the following to your settings.py document:

LOG_LEVEL = 'INFO'

See the documentation.




回答2:


You can also disable it completely with LOG_ENABLED=False. And you can pass settings when invoking the command: scrapy crawl myspider -s LOG_ENABLED=False




回答3:


You can also use --nolog in command prompt.

> scrapy crawl myspider --nolog

--nolog command Sets LOG_ENABLED to False

see documentation scrapy command line options



来源:https://stackoverflow.com/questions/17000764/scrapy-how-to-disable-or-change-log

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!