Skip to content

Commit

Permalink
DPM 199 Data Hub API logging (#5304)
Browse files Browse the repository at this point in the history
* Change logging to ASIM formatter

* Update common_logging.py
  • Loading branch information
marijnkampf authored and cgsunkel committed Jul 15, 2024
1 parent 618348d commit 06432e8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 27 deletions.
17 changes: 9 additions & 8 deletions config/settings/common_logging.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import sys
import sentry_sdk
from django_log_formatter_ecs import ECSFormatter
from django_log_formatter_asim import ASIMFormatter

from sentry_sdk.integrations.django import DjangoIntegration

from config.settings.common import *
Expand All @@ -13,30 +14,30 @@
'verbose': {
'format': '%(asctime)s [%(levelname)s] [%(name)s] %(message)s'
},
'ecs_formatter': {
'()': ECSFormatter,
"asim_formatter": {
"()": ASIMFormatter,
},
},
'handlers': {
'ecs': {
'asim': {
'class': 'logging.StreamHandler',
'formatter': 'ecs_formatter',
'formatter': 'asim_formatter',
'stream': sys.stdout,
},
},
'root': {
'level': 'INFO',
'handlers': ['ecs'],
'handlers': ['asim'],
},
'loggers': {
'django': {
'level': 'INFO',
'handlers': ['ecs'],
'handlers': ['asim'],
'propagate': False,
},
'django.db.backends': {
'level': 'ERROR',
'handlers': ['ecs'],
'handlers': ['asim'],
'propagate': False,
},
},
Expand Down
14 changes: 5 additions & 9 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ django==4.2.14
# django-extensions
# django-filter
# django-js-asset
# django-log-formatter-asim
# django-redis
# django-reversion
# djangorestframework
Expand All @@ -84,11 +85,9 @@ django-extensions==3.2.3
# via -r requirements.in
django-filter==24.2
# via -r requirements.in
django-ipware==3.0.7
# via django-log-formatter-ecs
django-js-asset==2.0.0
# via django-mptt
django-log-formatter-ecs==0.0.5
django-log-formatter-asim==0.0.4
# via -r requirements.in
django-mptt==0.16.0
# via -r requirements.in
Expand Down Expand Up @@ -183,14 +182,10 @@ jmespath==1.0.1
# via
# boto3
# botocore
kubi-ecs-logger==0.1.2
# via django-log-formatter-ecs
mail-parser==3.15.0
# via -r requirements.in
markupsafe==2.1.2
# via werkzeug
marshmallow==3.19.0
# via kubi-ecs-logger
matplotlib-inline==0.1.6
# via ipython
mccabe==0.7.0
Expand Down Expand Up @@ -218,7 +213,6 @@ opensearch-py==2.6.0
packaging==22.0
# via
# build
# marshmallow
# pytest
# python-redis-rate-limit
pandas==2.2.2
Expand All @@ -240,7 +234,9 @@ platformdirs==2.6.0
pluggy==1.5.0
# via pytest
pre-commit==3.7.1
# via -r requirements-dev.in
# via
# -r requirements-dev.in
# django-log-formatter-asim
prompt-toolkit==3.0.41
# via ipython
psycogreen==1.0.2
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ django-csp==3.8
django-environ==0.11.2
django-extensions==3.2.3
django-filter==24.2
django-log-formatter-ecs==0.0.5
django-log-formatter-asim==0.0.4
django-mptt==0.16.0
django-pglocks==1.0.4
django-reversion==5.0.12
Expand Down
30 changes: 21 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ certifi==2024.7.4
# opensearch-py
# requests
# sentry-sdk
cfgv==3.4.0
# via pre-commit
chardet==5.2.0
# via -r requirements.in
charset-normalizer==2.1.1
Expand All @@ -40,6 +42,8 @@ click==8.1.3
# via rq
crontab==1.0.0
# via rq-scheduler
distlib==0.3.8
# via virtualenv
django==4.2.14
# via
# -r requirements.in
Expand All @@ -49,6 +53,7 @@ django==4.2.14
# django-extensions
# django-filter
# django-js-asset
# django-log-formatter-asim
# django-redis
# django-reversion
# djangorestframework
Expand All @@ -64,11 +69,9 @@ django-extensions==3.2.3
# via -r requirements.in
django-filter==24.2
# via -r requirements.in
django-ipware==3.0.7
# via django-log-formatter-ecs
django-js-asset==2.0.0
# via django-mptt
django-log-formatter-ecs==0.0.5
django-log-formatter-asim==0.0.4
# via -r requirements.in
django-mptt==0.16.0
# via -r requirements.in
Expand All @@ -88,6 +91,8 @@ elastic-apm==6.22.3
# via -r requirements.in
events==0.5
# via opensearch-py
filelock==3.13.3
# via virtualenv
freezegun==1.5.1
# via rq-scheduler
frozenlist==1.3.3
Expand All @@ -100,6 +105,8 @@ greenlet==3.0.1
# via gevent
icalendar==5.0.13
# via -r requirements.in
identify==2.5.35
# via pre-commit
idna==3.7
# via
# requests
Expand All @@ -110,20 +117,18 @@ jmespath==1.0.1
# via
# boto3
# botocore
kubi-ecs-logger==0.1.2
# via django-log-formatter-ecs
mail-parser==3.15.0
# via -r requirements.in
markupsafe==2.1.2
# via werkzeug
marshmallow==3.19.0
# via kubi-ecs-logger
mohawk==1.1.0
# via -r requirements.in
multidict==6.0.4
# via
# aiohttp
# yarl
nodeenv==1.8.0
# via pre-commit
notifications-python-client==9.1.0
# via -r requirements.in
numpy==1.24.3
Expand All @@ -135,11 +140,14 @@ opensearch-py==2.6.0
# -r requirements.in
# opensearch-dsl
packaging==22.0
# via
# marshmallow
# python-redis-rate-limit
pandas==2.2.2
# via -r requirements.in
platformdirs==4.2.0
# via virtualenv
pre-commit==3.7.0
# via django-log-formatter-asim
psycogreen==1.0.2
# via -r requirements.in
psycopg2-binary==2.9.9
Expand All @@ -163,7 +171,9 @@ pytz==2022.7
# icalendar
# pandas
pyyaml==6.0.1
# via -r requirements.in
# via
# -r requirements.in
# pre-commit
redis==4.5.4
# via
# django-redis
Expand Down Expand Up @@ -220,6 +230,8 @@ urllib3==1.26.19
# opensearch-py
# requests
# sentry-sdk
virtualenv==20.25.1
# via pre-commit
werkzeug==3.0.3
# via -r requirements.in
whitenoise==6.7.0
Expand Down

0 comments on commit 06432e8

Please sign in to comment.