Update logging

This commit is contained in:
Sonny 2020-06-29 20:42:58 +02:00
parent 3c080e1300
commit 73ddb785e0
2 changed files with 15 additions and 12 deletions

View file

@ -103,13 +103,13 @@ CACHES = {
# https://docs.djangoproject.com/en/2.2/topics/logging/#configuring-logging
LOGGING = {
"version": 1,
"disable_existing_loggers": True,
"disable_existing_loggers": False,
"filters": {
"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"},
"require_debug_true": {"()": "django.utils.log.RequireDebugTrue"},
},
"formatters": {
"django.server": {
"timestamped": {
"()": "django.utils.log.ServerFormatter",
"format": "[{server_time}] {message}",
"style": "{",
@ -125,12 +125,7 @@ LOGGING = {
"level": "INFO",
"filters": ["require_debug_true"],
"class": "logging.StreamHandler",
},
"django.server": {
"level": "INFO",
"filters": ["require_debug_true"],
"class": "logging.StreamHandler",
"formatter": "django.server",
"formatter": "timestamped",
},
"mail_admins": {
"level": "ERROR",
@ -155,10 +150,15 @@ LOGGING = {
"loggers": {
"django": {
"handlers": ["console", "mail_admins", "syslog_errors"],
"level": "INFO",
"level": "WARNING",
},
"django.server": {
"handlers": ["django.server"],
"handlers": ["console", "syslog_errors"],
"level": "INFO",
"propagate": False,
},
"django.request": {
"handlers": ["console", "syslog_errors"],
"level": "INFO",
"propagate": False,
},

View file

@ -53,11 +53,14 @@ REGISTRATION_OPEN = False
# Optionally use sentry integration
try:
from sentry_sdk import init as sentry_init
from sentry_sdk.integrations.django import CeleryIntegration, DjangoIntegration
from sentry_sdk import integrations
sentry_init(
dsn=os.environ.get("SENTRY_DSN"),
integrations=[DjangoIntegration(), CeleryIntegration()],
integrations=[
integrations.django.DjangoIntegration(),
integration.celery.CeleryIntegration(),
],
send_default_pii=False,
)
except ImportError: