title: Django Logging with Elastic Beanstalk (AWS)
body: <p>I am deploying a web service built on Django/Python at AWS using Elastic Beanstalk. I am using Django's logging feature to log website use and related data. While that worked fine with local testing, I an unable to get this to work with Beanstalk.</p>
  
  <p>My code to log in <code>settings.py</code> is:</p>
  
  <pre><code># Django Logging
  
  LOGGING = {
      'version': 1,
      'disable_existing_loggers': False,
      'formatters': {
          'verbose': {
              'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
              'datefmt' : "%d/%b/%Y %H:%M:%S"
          },
          'simple': {
          'format': '%(levelname)s %(message)s'
          },
      },
      'handlers': {
          'file': {
              'level': 'DEBUG',
              'class': 'logging.FileHandler',
              'filename': 'spareguru.log',
              'formatter': 'verbose'
          },
      },
      'loggers': {
          'django': {
              'handlers':['file'],
              'propagate': True,
              'level':'DEBUG',
           },
          'customer': {
              'handlers': ['file'],
              'level': 'DEBUG',
           },
      }
  }
  </code></pre>
  
  <p>The error I get while deploying to Beanstalk is:</p>
  
  <pre><code>ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/opt/python/bundle/3/app/spareguru.log'
  </code></pre>
  
  <p>I also tried creating a file using <code>.ebextensions</code> and making <code>wsgi</code> the owner of that file but that didn't work either.</p>
  
  <p>How can I fix this?</p>