Skip to content
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

feat: improve / clean up logging #7591

Merged
merged 12 commits into from
Jun 26, 2024
Prev Previous commit
Next Next commit
chore: gunicorn logs as JSON (wip)
  • Loading branch information
jennifer-richards committed Jun 25, 2024
commit fb87979f435e19d2823a10bde4d5ca6eed270870
1 change: 1 addition & 0 deletions dev/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ COPY . .
COPY ./dev/build/start.sh ./start.sh
COPY ./dev/build/datatracker-start.sh ./datatracker-start.sh
COPY ./dev/build/celery-start.sh ./celery-start.sh
COPY ./dev/build/gunicorn.conf.py ./gunicorn.conf.py

RUN pip3 --disable-pip-version-check --no-cache-dir install -r requirements.txt && \
echo '# empty' > ietf/settings_local.py && \
Expand Down
21 changes: 21 additions & 0 deletions dev/build/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from pythonjsonlogger.jsonlogger import JsonFormatter
from gunicorn.glogging import CONFIG_DEFAULTS

logconfig_dict = CONFIG_DEFAULTS
logconfig_dict["loggers"]["gunicorn.access"] = {
"level": "INFO",
"handlers": ["json_request"],
"propagate": False,
}
logconfig_dict["loggers"]["gunicorn.error"] = {
"level": "INFO",
"handlers": ["json_request"],
"propagate": False,
}
logconfig_dict["handlers"]["json_request"] = {
"class": "logging.StreamHandler",
"formatter": "gunicorn_json",
}
logconfig_dict["formatters"]["gunicorn_json"] = {
"()": JsonFormatter,
}