diff --git a/arkindex/project/settings.py b/arkindex/project/settings.py index 19c35787589e576b8c3b0975e0b9ffa5ddf5d202..953b10bf6c5fd1b0475c7d3881f80e3afcc9dc0c 100644 --- a/arkindex/project/settings.py +++ b/arkindex/project/settings.py @@ -311,16 +311,10 @@ LOGGING = { 'formatter': 'simple', 'filters': ['require_debug_true'], }, - 'mail_admins': { - 'level': 'ERROR', - 'filters': ['require_debug_false'], - 'class': 'django.utils.log.AdminEmailHandler', - 'include_html': True, - }, }, 'loggers': { 'django': { - 'handlers': ['console', 'mail_admins', ], + 'handlers': ['console', ], 'level': 'INFO', 'propagate': True, }, @@ -348,6 +342,9 @@ LOGGING = { }, } +# Sentry Error reporting +SENTRY_DSN = os.environ.get('SENTRY_DSN') + # Email EMAIL_SUBJECT_PREFIX = '[Arkindex {}] '.format(ARKINDEX_ENV) if os.environ.get('EMAIL_HOST'): @@ -489,3 +486,16 @@ try: INSTALLED_APPS.append('debug_toolbar') except ImportError: pass + +if SENTRY_DSN: + import sentry_sdk + from sentry_sdk.integrations.django import DjangoIntegration + + sentry_sdk.init( + dsn=SENTRY_DSN, + integrations=[DjangoIntegration()], + environment=ARKINDEX_ENV, + release=VERSION, + debug=DEBUG, + send_default_pii=True + ) diff --git a/requirements.txt b/requirements.txt index c7bde7bcd73f1b8a9b43a11a9a1cfbae92281411..57ee497f5e276cfdad77df9f4a308c602cf8f94d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,5 +23,6 @@ pytz>=2018.7 PyYAML==5.1 responses==0.10.7 requests==2.22 +sentry-sdk==0.14.3 urllib3==1.22 git+https://gitlab.com/arkindex/common.git#egg=arkindex-common