root: fix some logs not being json

This commit is contained in:
Jens Langhammer 2020-09-06 15:52:48 +02:00
parent 80e8a3d63c
commit 6ebefc9f17
2 changed files with 31 additions and 3 deletions

View File

@ -35,4 +35,16 @@ logconfig_dict = {
}, },
"console": {"class": "logging.StreamHandler", "formatter": "json_formatter"}, "console": {"class": "logging.StreamHandler", "formatter": "json_formatter"},
}, },
"loggers": {
"uvicorn": {
"handlers": ["console"],
"level": "WARNING",
"propagate": False,
},
"gunicorn": {
"handlers": ["console"],
"level": "INFO",
"propagate": False,
},
},
} }

View File

@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/2.1/ref/settings/
import importlib import importlib
import os import os
import sys import sys
from json import dumps
import structlog import structlog
from celery.schedules import crontab from celery.schedules import crontab
@ -270,8 +271,15 @@ if CONFIG.y("postgresql.backup"):
AWS_STORAGE_BUCKET_NAME = CONFIG.y("postgresql.backup.bucket") AWS_STORAGE_BUCKET_NAME = CONFIG.y("postgresql.backup.bucket")
AWS_S3_ENDPOINT_URL = CONFIG.y("postgresql.backup.host") AWS_S3_ENDPOINT_URL = CONFIG.y("postgresql.backup.host")
AWS_DEFAULT_ACL = None AWS_DEFAULT_ACL = None
LOGGER.info( print(
"Database backup is configured", host=CONFIG.y("postgresql.backup.host") dumps(
{
"event": "Database backup is configured.",
"level": "info",
"logger": __name__,
"host": CONFIG.y("postgresql.backup.host"),
}
)
) )
# Add automatic task to backup # Add automatic task to backup
CELERY_BEAT_SCHEDULE["db_backup"] = { CELERY_BEAT_SCHEDULE["db_backup"] = {
@ -282,7 +290,15 @@ if CONFIG.y("postgresql.backup"):
# Sentry integration # Sentry integration
_ERROR_REPORTING = CONFIG.y_bool("error_reporting.enabled", False) _ERROR_REPORTING = CONFIG.y_bool("error_reporting.enabled", False)
if not DEBUG and _ERROR_REPORTING: if not DEBUG and _ERROR_REPORTING:
LOGGER.info("Error reporting is enabled.") print(
dumps(
{
"event": "Error reporting is enabled.",
"level": "info",
"logger": __name__,
}
)
)
sentry_init( sentry_init(
dsn="https://33cdbcb23f8b436dbe0ee06847410b67@sentry.beryju.org/3", dsn="https://33cdbcb23f8b436dbe0ee06847410b67@sentry.beryju.org/3",
integrations=[ integrations=[