Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gunicorn log HTTP requests made to it

I am running gunicorn with the below config

$VIRT_ENV/gunicorn -c config.py utrade.wsgi:application \
                          --log-level=debug \
                          --timeout=0 \
                          --access-logfile=-\
                          --log-file=-

However it won't log HTTP requests (POST/GET) like Django would do if ran standalone. Like the ones below

INFO:django.server:"GET / HTTP/1.1" 302 0
INFO:django.server:"GET /login/?next=/ HTTP/1.1" 200 5676
like image 644
garg10may Avatar asked Mar 19 '18 13:03

garg10may


1 Answers

Add gunicorn.access in loggers in django settings.py file in the 'loggers' block.

LOGGING = {
  # ..
  'loggers': {
     # ..
     'gunicorn.access' : {
         'level': 'DEBUG',
         'handlers': ['console'],
         'propagate':False
     }
   }
}
like image 129
garg10may Avatar answered Sep 22 '22 20:09

garg10may