Gunicorn - No access logs

27,857

could you try :

gunicorn --config config.py app:app --access-logfile '-'

And see if anything is logged on stdout(console output)?

Share:
27,857
Creative crypter
Author by

Creative crypter

Updated on December 19, 2020

Comments

  • Creative crypter
    Creative crypter over 3 years

    currently i am running my sanic(microframework) webservice with gunicorn as a daemon and i would like to save all logs in files(access and error)

    My config:

    reload = True
    daemon = True
    bind = '0.0.0.0:6666'
    worker_class = 'sanic.worker.GunicornWorker'
    loglevel = 'debug'
    accesslog = 'access.log'
    access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
    errorlog = 'error.log'
    

    Next i start the webservice:

    gunicorn --config config.py app:app
    

    Sooo.. my errorlog works, but i get absolutely no accesslogs..

    There is no hint in the documentation about this issue, could anybody help me?

    Thanks and Greetings!

  • Christo Goosen
    Christo Goosen about 6 years
    Forgot to mention, why don't you add nginx as a reverse proxy? Then nginx can handle the pure 'access logs' even before it reaches sanic.
  • srikar kulkarni
    srikar kulkarni over 3 years
    No luck. When I'm tried to hit my endpoint , I dont see any log regarding the request
  • Arunprasad Rajkumar
    Arunprasad Rajkumar over 3 years
    @srikarkulkarni, it is because you are overriding the cmd switch --access-logfile through gunicorn config. Try removing accesslog or change it to accesslog = '-'. docs.gunicorn.org/en/latest/settings.html#logging