Add django file logging for stage

This commit is contained in:
Oliver Marks 2017-02-05 14:22:35 +00:00
parent e3d266e539
commit 46502c164a
2 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,7 @@
#!/bin/sh #!/bin/sh
python /app/manage.py collectstatic --noinput python /app/manage.py collectstatic --noinput
python /app/manage.py compilescss python /app/manage.py compilescss
mkdir /var/log/gunicorn/
chown -R root:django /var/log/gunicorn/
chmod -R 770 /var/log/gunicorn/
/usr/local/bin/gunicorn config.wsgi -w 4 -b unix:/data/sockets/gunicorn.sock --error-logfile /var/log/gunicorn/gunicorn-error.log --chdir=/app /usr/local/bin/gunicorn config.wsgi -w 4 -b unix:/data/sockets/gunicorn.sock --error-logfile /var/log/gunicorn/gunicorn-error.log --chdir=/app

View File

@ -195,6 +195,11 @@ LOGGING = {
'class': 'logging.StreamHandler', 'class': 'logging.StreamHandler',
'formatter': 'verbose', 'formatter': 'verbose',
}, },
'logfile': {
'level':'DEBUG',
'class':'logging.FileHandler',
'filename': BASE_DIR + "/../logfile",
},
}, },
'loggers': { 'loggers': {
'django.request': { 'django.request': {
@ -204,7 +209,7 @@ LOGGING = {
}, },
'django.security.DisallowedHost': { 'django.security.DisallowedHost': {
'level': 'ERROR', 'level': 'ERROR',
'handlers': ['console', 'mail_admins'], 'handlers': ['logfile', 'console', 'mail_admins'],
'propagate': True 'propagate': True
} }
} }