-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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-logformat STRING not working #2382
Comments
I also faced this problem... Is there workaround? |
This problem happens when using option # gunicorn.conf.py
accesslog = "./logs/gunicorn/gunicorn.access.logs"
errorlog = "./logs/gunicorn/gunicorn.error.logs"
access_log_format = "%({x-forwarded-for}i)s %(l)s %(l)s %(l)s %(l)s'" Not Using the option (with normal worker) >>> I wonder whoes problem is this (uvicorn or gunicorn) Related problem: #2382(this) #2299 encode/uvicorn#389 >> first issued |
There's nothing Gunicorn can do. |
no activity since awhile. closing feel free to create a new ticket if needed. |
It's a Uvicorn issue then? |
Yes |
When using https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker FastAPI, it seems the access_log format cannot be customized, neither with log-config nor with --access-logformat
-------------------start.sh--------------
#start.sh
exec gunicorn -k uvicorn.workers.UvicornWorker -c "$GUNICORN_CONF" "$APP_MODULE" --log-config "/logging.conf" --access-logformat "%(h)s %(l)s %(u)s %(t)s %(r)s %(s)s %(b)s %(f)s %(a)s"
-------------------logging.conf--------
[loggers]
keys=root, gunicorn.error, gunicorn.access,uvicorn.error,uvicorn.access
[handlers]
keys=console, error_file, access_file, accesscustom
[formatters]
keys=generic, access, AccessFormatter
[logger_root]
level=INFO
handlers=console
propagate=1
[logger_gunicorn.error]
level=INFO
handlers=error_file
propagate=0
qualname=gunicorn.error
[logger_gunicorn.access]
level=INFO
handlers=accesscustom
propagate=0
qualname=gunicorn.access
[logger_uvicorn.error]
level=INFO
handlers=error_file
propagate=0
qualname=uvicorn.error
[logger_uvicorn.access]
level=INFO
handlers=access_file
propagate=0
qualname=uvicorn.access
[handler_console]
class=StreamHandler
formatter=generic
args=(sys.stdout, )
[handler_error_file]
class=StreamHandler
formatter=generic
args=(sys.stdout, )
[handler_access_file]
class=StreamHandler
formatter=access
args=(sys.stdout, )
[handler_accesscustom]
class=StreamHandler
formatter=AccessFormatter
args=(sys.stdout, )
[formatter_generic]
format=[%(levelname)s]: %(message)s
datefmt=%Y-%m-%dT%H:%M:%S
class=logging.Formatter
[formatter_access]
format=[%(levelname)s]: %(message)s
datefmt=%Y-%m-%dT%H:%M:%S
class=logging.Formatter
[formatter_AccessFormatter]
format=[%(levelname)s]: %(message)s
datefmt=%Y-%m-%dT%H:%M:%S
class=logging.Formatter
access_log_format = %(h)s %(l)s %(u)s %(t)s %(r)s %(s)s %(b)s %(f)s %(a)s
`
The text was updated successfully, but these errors were encountered: