From 701125b6c2a9ea93662b8a0a1b07c0fcec4b18bb Mon Sep 17 00:00:00 2001 From: Ali Zaidi Date: Fri, 4 Jun 2021 11:00:41 +0100 Subject: [PATCH 1/3] Remove python-json-logger. --- Pipfile | 1 - Pipfile.lock | 39 ++++++++++++++++----------------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Pipfile b/Pipfile index d28f73ae..792850ac 100644 --- a/Pipfile +++ b/Pipfile @@ -23,7 +23,6 @@ elastic-apm = "~=5.8" sentry-sdk = "~=0.16" typed-ast = "~=1.4.2" mohawk = ">=1.1" -python-json-logger = "~=0.1" psycopg2 = "~=2.8" python-dateutil = "~=2.8" requests = "~=2.21" diff --git a/Pipfile.lock b/Pipfile.lock index c5d84793..4124deee 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "a9cb3b516ae6ba6d68c5ac6c3df16ef4825405d2b494d8c94262c492f984fdf5" + "sha256": "d04ecd234e68f7c198ec4dff9973b221278db31da02b00339b6d080bb7529df0" }, "pipfile-spec": 6, "requires": { @@ -18,10 +18,10 @@ "default": { "certifi": { "hashes": [ - "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c", - "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830" + "sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee", + "sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8" ], - "version": "==2020.12.5" + "version": "==2021.5.30" }, "chardet": { "hashes": [ @@ -33,11 +33,11 @@ }, "django": { "hashes": [ - "sha256:12cfc045a4ccb2348719aaaa77b17e66a26bff9fc238b4c765a3e825ef92e414", - "sha256:2710bff9dd480cf886e38947ee00aea3d6b9b04b77a748e352e3ce447b0fe17f" + "sha256:3339ff0e03dee13045aef6ae7b523edff75b6d726adf7a7a48f53d5a501f7db7", + "sha256:f2084ceecff86b1e631c2cd4107d435daf4e12f1efcdf11061a73bf0b5e95f92" ], "index": "pypi", - "version": "==2.2.23" + "version": "==2.2.24" }, "django-background-tasks": { "hashes": [ @@ -193,13 +193,6 @@ "index": "pypi", "version": "==2.8.1" }, - "python-json-logger": { - "hashes": [ - "sha256:b7a31162f2a01965a5efb94453ce69230ed208468b0bbc7fdfc56e6d8df2e281" - ], - "index": "pypi", - "version": "==0.1.11" - }, "pytz": { "hashes": [ "sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da", @@ -285,11 +278,11 @@ }, "urllib3": { "hashes": [ - "sha256:2f4da4594db7e1e110a944bb1b551fdf4e6c136ad42e4234131391e21eb5b0df", - "sha256:e7b021f7241115872f92f43c6508082facffbd1c048e3c6e2bb9c2a157e28937" + "sha256:753a0374df26658f99d826cfe40394a686d05985786d946fbe4165b5148f5a7c", + "sha256:a7acd0977125325f516bda9735fa7142b909a8d01e8b2e4c8108d0984e6e0098" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", - "version": "==1.26.4" + "version": "==1.26.5" } }, "develop": { @@ -408,11 +401,11 @@ }, "django": { "hashes": [ - "sha256:12cfc045a4ccb2348719aaaa77b17e66a26bff9fc238b4c765a3e825ef92e414", - "sha256:2710bff9dd480cf886e38947ee00aea3d6b9b04b77a748e352e3ce447b0fe17f" + "sha256:3339ff0e03dee13045aef6ae7b523edff75b6d726adf7a7a48f53d5a501f7db7", + "sha256:f2084ceecff86b1e631c2cd4107d435daf4e12f1efcdf11061a73bf0b5e95f92" ], "index": "pypi", - "version": "==2.2.23" + "version": "==2.2.24" }, "django-extensions": { "hashes": [ @@ -447,11 +440,11 @@ }, "importlib-metadata": { "hashes": [ - "sha256:8c501196e49fb9df5df43833bdb1e4328f64847763ec8a50703148b73784d581", - "sha256:d7eb1dea6d6a6086f8be21784cc9e3bcfa55872b52309bc5fad53a8ea444465d" + "sha256:833b26fb89d5de469b24a390e9df088d4e52e4ba33b01dc5e0e4f41b81a16c00", + "sha256:b142cc1dd1342f31ff04bb7d022492b09920cb64fed867cd3ea6f80fe3ebd139" ], "markers": "python_version < '3.8'", - "version": "==4.0.1" + "version": "==4.5.0" }, "isort": { "hashes": [ From 096066b3190e4d10c21b63485db88e151923430d Mon Sep 17 00:00:00 2001 From: Ali Zaidi Date: Fri, 4 Jun 2021 11:04:48 +0100 Subject: [PATCH 2/3] Remove json logger from logging config. --- conf/settings.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/conf/settings.py b/conf/settings.py index 40a67fb9..112fb8ec 100644 --- a/conf/settings.py +++ b/conf/settings.py @@ -15,6 +15,7 @@ import uuid from environ import Env +from django_log_formatter_ecs import ECSFormatter import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration @@ -187,17 +188,14 @@ "version": 1, "disable_existing_loggers": False, "formatters": { - "json": { - "class": "pythonjsonlogger.jsonlogger.JsonFormatter", - "format": "(asctime)(levelname)(message)(filename)(lineno)(threadName)(name)(thread)(created)(process)(processName)(relativeCreated)(module)(funcName)(levelno)(msecs)(pathname)", # noqa - }, - "ecs_formatter": {"class": "django_log_formatter_ecs.ECSFormatter"}, + "simple": {"format": "{asctime} {levelname} {message}", "style": "{"}, + "ecs_formatter": {"()": ECSFormatter}, }, "handlers": { - "console": {"class": "logging.StreamHandler", "formatter": "json"}, + "stdout": {"class": "logging.StreamHandler", "formatter": "simple"}, "ecs": {"class": "logging.StreamHandler", "formatter": "ecs_formatter"}, }, - "loggers": {"": {"handlers": ["console", "ecs"], "level": env("LOG_LEVEL").upper()}}, + "root": {"handlers": ["stdout", "ecs"], "level": env("LOG_LEVEL").upper()}, } else: LOGGING = {"version": 1, "disable_existing_loggers": True} From 70d261f1c6eaa4a0872153217b0788e43a3a5a5b Mon Sep 17 00:00:00 2001 From: Ali Zaidi Date: Fri, 4 Jun 2021 12:10:26 +0100 Subject: [PATCH 3/3] Remove hardcoded DEBUG. --- conf/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/settings.py b/conf/settings.py index 112fb8ec..0c4e939b 100644 --- a/conf/settings.py +++ b/conf/settings.py @@ -48,7 +48,7 @@ DJANGO_SECRET_KEY = env("DJANGO_SECRET_KEY") # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = env.bool("DEBUG", False) ALLOWED_HOSTS = "*"