title: Django logging throws 500 internal server error
body: <p>I am having problems logging in my Django project.</p>
  
  <p>In my <code>view.py</code> in an "application" I am doing the following:</p>
  
  <pre><code>import logging
  
  logging.basicConfig(filename="django.log",level=logging.DEBUG)
  
  def request(request):
      logging.debug("test debugging")
  </code></pre>
  
  <p>with a <code>django.log</code> file in the same directory as the <code>view.py</code> file.</p>
  
  <p>Now when making a request from the browser I keep getting a 500 Internal Server error as shown in Firebug. I can get logging to work just fine when I simply run it through the interactive python shell or executing it from a <code>.py</code> file like the following:</p>
  
  <pre><code>import logging
  
  logging.basicConfig(filename="django.log",level=logging.DEBUG)
  
  def testLogging():
      logging.debug("test debugging")
  
  if __name__ == "__main__"
      testLogging()
  </code></pre>
  
  <p>, and then executing <code>python nameOfFile.py</code>.</p>
  
  <p>What am I doing wrong? I am running Django 1.1.1 and Python 2.6.5. Maybe I should upgrade Django?</p>