Skip to content

Add environment variables to gunicorn access log format - #1291

Merged
benoitc merged 2 commits into
benoitc:masterfrom
lyft:add-environ-variables-to-logger
Jun 4, 2016
Merged

benoitc merged 2 commits into
benoitc:masterfrom
lyft:add-environ-variables-to-logger

Conversation

@vivianho

@vivianho vivianho commented Jun 2, 2016

Copy link
Copy Markdown
Contributor

Add environment variables to gunicorn access log format using {Variable}e.

Updated the docs to include the new identifier.

@benoitc

benoitc commented Jun 3, 2016

Copy link
Copy Markdown
Owner

thanks for the patch! But settings.rst shouldn't be edited. Instead you should update the config.py file in the AccessLog class. Can you resend your PR with that change?

@vivianho

vivianho commented Jun 3, 2016

Copy link
Copy Markdown
Contributor Author

@benoitc updated docs.

@benoitc
benoitc merged commit ac708f5 into benoitc:master Jun 4, 2016
@benoitc

benoitc commented Jun 4, 2016

Copy link
Copy Markdown
Owner

thanks!

@mtvx

mtvx commented Mar 5, 2017

Copy link
Copy Markdown

Just saw this released into 19.7.0.

Did you consider the performance impact? Iterating the environment variable map for each log line feels unnecessary as you rarely change the environment variables in-process.

Why not populate it at the startup and re-use later on? I guess the performance impact just is negligible?

@RonRothman

RonRothman commented Mar 5, 2017 via email

Copy link
Copy Markdown

@berkerpeksag

Copy link
Copy Markdown
Collaborator

+1 for fixing this in a bugfix release.

@benoitc

benoitc commented Mar 8, 2017

Copy link
Copy Markdown
Owner

actually do we know if it's really an issue? Im not sure having the env variable prepopulated vs using the dict will give much (except maybe by writing it to a string first...

All this access logging is fragile anyway and it's why it's not enabled by default (if you use gunicorn behind a proxy you don't need it) . IMO, while we are on it a better fix would be putting the logging in its own thread/process instead of doing it synchronously like we're doing now imo. I have the feeling that any other fix would just distract us from the real one. Thoughts?

mjjbell pushed a commit to mjjbell/gunicorn that referenced this pull request Mar 16, 2018
…gger

Add environment variables to gunicorn access log format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants