title: Logging from Django under UWSGI
body: <p>I am running my django app via uwsgi server and am starting 32 processes -args in my init script are:</p>
  
  <pre><code>ARGS="--pidfile ${PIDFILE} --uid ${UID} -s /tmp/${NAME}.sock --pythonpath ${GCS_HOME}/server/src/gcs --master -w wsgi -d ${GCS_HOME}/logs/uwsgi.log -p 32 -z 30"
  </code></pre>
  
  <p>Versions are Python 2.6.5 , Django 1.2.1, uWSGI 0.9.5.1</p>
  
  <p>I want to have a single log file so I am using a multprocessing based log handler as described in <a href="https://stackoverflow.com/questions/641420">question 641420</a>.</p>
  
  <p>The multilogging handler works fine in a simple test app that I have and also when I run the manage.py runserver_plus with werkzeug, but nothing is logged when I run with django and uwsgi (I get no errors or exceptions from uwsgi process either though) .</p>
  
  <p>My wsgi file is below, if anyone can identify a problem with my config or an explanation for what is happening I'd be grateful:</p>
  
  <pre><code>APP_VIRTUAL_ENV = "/home/devadmin/gcs/server/gcs_env/"
  APP_PARENT_PATH = "/home/devadmin/gcs/server/src/"
  
  ##                                                                              
  
  import sys
  # Redirect stdout to comply with WSGI                                           
  sys.stdout = sys.stderr
  
  import os, site
  
  # Set the settings module django should use                                     
  os.environ['DJANGO_SETTINGS_MODULE'] = "gcs.settings"
  
  # set the sys.path                                                              
  site_packages_subpath = "/lib/python%s.%s/site-packages" % (sys.version_info[0]\
  , sys.version_info[1], )
  site_packages_path = os.path.join(APP_VIRTUAL_ENV, site_packages_subpath[1:])
  
  sys_path = []
  for path in sys.path:
      if site_packages_subpath in path and not path.startswith(APP_VIRTUAL_ENV):
          continue
      sys_path.append(path)
  
  sys.path = [ APP_PARENT_PATH ]
  sys.path += sys_path
  site.addsitedir(site_packages_path)
  
  # reorder sys.path                                                              
  for path in sys_path:
      sys.path.remove(path)
  sys.path += sys_path
  
  # setup logging                                                                 
  import os.path
  import logging
  import logging.config
  logging.config.fileConfig(os.path.join(os.path.dirname(__file__), "logging.conf\
  "))
  </code></pre>