title: Logging in Scrapy
body: <p>I am having trouble with logging in scrapy, and most of what I can find is out of date.</p>
  
  <p>I have set <code>LOG_FILE="log.txt"</code> in the <code>settings.py</code> file and from the documentation, this should work:</p>
  
  <blockquote>
    <p>Scrapy provides a logger within each Spider instance, that can be accessed and used like this:</p>
  </blockquote>
  
  <pre><code>import scrapy
  
  class MySpider(scrapy.Spider):
  
      name = 'myspider'
      start_urls = ['http://scrapinghub.com']
  
      def parse(self, response):
          self.logger.info('Parse function called on %s', response.url)
  </code></pre>
  
  <p>But when I do:</p>
  
  <pre><code>class MySpider(CrawlSpider):
      #other code
      def parse_page(self,response):
          self.logger.info("foobar")
  </code></pre>
  
  <p>I get nothing. If I set </p>
  
  <pre><code>logger = logging.basicConfig(filename="log.txt",level=logging.INFO)
  </code></pre>
  
  <p>At the top of my file, after my imports, it creates a log file, and the default output gets logged just fine, but </p>
  
  <pre><code>class MySpider(CrawlSpider):
      #other code
      def parse_page(self,response):
          logger.info("foobar")
  </code></pre>
  
  <p>Fails to make an appearance. I have also tried putting it in the class <code>__init__</code>, as such:</p>
  
  <pre><code>def __init__(self, *a, **kw):
      super(FanfictionSpider, self).__init__(*a, **kw)
      logging.basicConfig(filename="log.txt",level=logging.INFO)
  </code></pre>
  
  <p>I once again get no output to the file, just to the console, and <code>foobar</code> does not show up. Can someone please direct me on how to correctly log in Scrapy?</p>