Note that there are some explanatory texts on larger screens.

plurals
  1. POMake gunicorn log to sentry instead of a log file
    primarykey
    data
    text
    <p>I have a Django website that uses a gunicorn startup script. It currently logs errors within a log file.</p> <p>I am trying to change it to log to sentry (which I already have running and configured in settings.py)</p> <p>This is the startup script</p> <pre><code>#!/bin/bash set -e LOGFILE=/var/log/gunicorn/myproject.log LOGDIR=$(dirname $LOGFILE) NUM_WORKERS=5 # user/group to run as USER=root GROUP=root cd /root/virtualenvs/myproject/myproject source ../bin/activate test -d $LOGDIR || mkdir -p $LOGDIR exec ./manage.py run_gunicorn -w $NUM_WORKERS \ --user=$USER -b 127.0.0.1:8080 --group=$GROUP --log-level=debug \ --log-file=$LOGFILE 2&gt;&gt;$LOGFILE </code></pre> <p>I have changed it to</p> <pre><code>#!/bin/bash set -e LOGDIR=$(dirname $LOGFILE) NUM_WORKERS=5 # user/group to run as USER=root GROUP=root cd /root/virtualenvs/myproject/myproject source ../bin/activate exec ./manage.py run_gunicorn -w $NUM_WORKERS \ --user=$USER -b 127.0.0.1:8080 --group=$GROUP --log-level=debug </code></pre> <p>Which seems to cause the website to crash (Bad Gateway)</p> <p>This is my settings.py logging setup:</p> <pre><code>LOGGING = { 'version': 1, 'disable_existing_loggers': True, 'root': { 'level': 'WARNING', 'handlers': ['sentry'], }, 'formatters': { 'verbose': { 'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' }, }, 'handlers': { 'sentry': { 'level': 'ERROR', 'class': 'raven.contrib.django.handlers.SentryHandler', }, 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'verbose' } }, 'loggers': { 'django.db.backends': { 'level': 'ERROR', 'handlers': ['console'], 'propagate': False, }, 'raven': { 'level': 'DEBUG', 'handlers': ['console'], 'propagate': False, }, 'sentry.errors': { 'level': 'DEBUG', 'handlers': ['console'], 'propagate': False, }, }, } </code></pre> <p>I think this might have to do with the LOG LEVEL settings, but I'm not sure, any suggestions are welcome, thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload