From 472de72e660a07f35af98cf46d1b40916d44ba98 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 12 Apr 2025 22:04:21 +0200 Subject: [PATCH] Add logging configuration for the docker setup Also remove the PROMETHEUS_URL_PATH from the url, this was just making things complicated to setup --- extras/docker/production/settings.py | 28 ++++++++++++++++++++++++++++ wger/urls.py | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/extras/docker/production/settings.py b/extras/docker/production/settings.py index 3490c3930..4ea61bc50 100644 --- a/extras/docker/production/settings.py +++ b/extras/docker/production/settings.py @@ -188,3 +188,31 @@ CELERY_RESULT_BACKEND = env.str("CELERY_BACKEND", "redis://cache:6379/2") # EXPOSE_PROMETHEUS_METRICS = env.bool('EXPOSE_PROMETHEUS_METRICS', False) PROMETHEUS_URL_PATH = env.str('PROMETHEUS_URL_PATH', 'super-secret-path') + +# +# Logging +# +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'simple': { + 'format': 'level={levelname} ts={asctime} module={module} path={pathname} line={lineno} message={message}', + 'style': '{', + }, + }, + 'handlers': { + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + 'formatter': 'simple' + }, + }, + 'loggers': { + '': { + 'handlers': ['console'], + 'level': env.str('LOG_LEVEL_PYTHON', 'INFO').upper(), + 'propagate': True, + }, + } +} diff --git a/wger/urls.py b/wger/urls.py index 424d62ec9..b0e3808b2 100644 --- a/wger/urls.py +++ b/wger/urls.py @@ -353,5 +353,5 @@ if settings.DEBUG: if settings.EXPOSE_PROMETHEUS_METRICS: urlpatterns += [ - path(f'prometheus/{settings.PROMETHEUS_URL_PATH}/', include('django_prometheus.urls')) + path(f'prometheus/', include('django_prometheus.urls')) ]