How To Turn Off Logging in Scrapy (Python)
You can simply change the logging level for scrapy (or any other logger):
logging.getLogger('scrapy').setLevel(logging.WARNING)
This disables all log messages less than the WARNING
level.
To disable all scrapy log messages you can just set propagate
to False
:
logging.getLogger('scrapy').propagate = False
This prevents scrapy's log messages from propagating to the root logger (which prints to console when configured using basicConfig()
)
logging.basicConfig(**kwargs)
This function does nothing if the root logger already has handlers configured for it.
Scrapy has handlers configured for it, so this will not work
you can simply add --nolog
as a parameter when launching your spider using scrapy
command
I am using scrapy v1.7.3.
you can see more in help using command:
scrapy --help
You could add -s LOG_ENABLED=False
as a parameter when launching your script. That should do the trick.
Note: For the version 1.1 changed a little bit: -s LOG_ENABLED=0