-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
access log format is invalid when using gunicorn worker #705
Comments
I have found this problem too, just today. Thank you for the workaround. |
Just ran into this issue... Took me a couple of hours to find this answer. Thanks for the workaround, I was starting to get grey hairs. |
benoitc/gunicorn#1300 |
This is still an issue. |
Gunicorn config defaults are invalid for Other option is to pass access logger class to |
We can make a workaround.
We can also add a support for gunicorn style but it requires much more work and the solution is very complicated from my perspective. @f0t0n maybe you have an interest in fixing the issue? |
@asvetlov Gunicorn's
In this way if we call
Also I don't see a correct way to retrieve a format string from logger like |
access_logformat from gunicorn config is passed from GunicornWebWorker to ServerHttpProtocol, which constructs AccessLogger "wrapper" with gunicorn (invalid) default format instead of aiohttp's one. For me, access logs work with: gunicorn --worker-class=aiohttp.worker.GunicornWebWorker
--access-logformat="..."
--log-config=logging.conf logging.conf part: [logger_gunicorn.access]
level=INFO
handlers=access_file
propagate=0
qualname=gunicorn.access
[handler_access_file]
class=logging.handlers.TimedRotatingFileHandler
formatter=access
args=('/data/logs/access.log', 'midnight')
[formatter_access]
format=%(message)s # That's what glogger receives from AccessLogger wrapper
class=logging.Formatter |
Ok, I'll try to work with |
It seems you have to pass in
--access-logformat='%a %l %u %t "%r" %s %b "%{Referrer}i" "%{User-Agent}i"'
to gunicorn for logging to work, they default format from gunicorn is"%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
which doesn't work with aiohttpThe text was updated successfully, but these errors were encountered: