How to see output of print statements when scrapy logger enabled
logstdout
must be set to False to disable stdout from being redirected.
from scrapy import log
print 'PRINT OUTPUT BEFORE'
log.start(loglevel='DEBUG', logstdout=False)
print 'PRINT OUTPUT AFTER'
With output:
PRINT OUTPUT BEFORE
PRINT OUTPUT AFTER
I think above works for old version. They seems to have deprecated scrapy.log . Refer: https://docs.scrapy.org/en/latest/topics/logging.html
Eg:
import logging
logging.warning("This is a warning")
logging.info("This is an info")
logging.error("This is an error")
As my config was set to warn. I got only below
WARNING:root:This is a warning
ERROR:root:This is an error
Note that this is helpful if you are using scrapyd. As scrapy crawl will print all but scrapyd doesn't do same way.