diff --git a/backend/Arquimedia/settings.py b/backend/Arquimedia/settings.py index 032c708d..47ed2774 100644 --- a/backend/Arquimedia/settings.py +++ b/backend/Arquimedia/settings.py @@ -10,6 +10,7 @@ https://docs.djangoproject.com/en/3.1/ref/settings/ """ from pathlib import Path +import logging.config import os from dotenv import load_dotenv from celery.schedules import crontab @@ -187,3 +188,33 @@ CELERY_TASK_SERIALIZER = 'json' CELERY_RESULT_SERIALIZER = 'json' CELERY_TIMEZONE = 'Europe/Lisbon' + +# Logging Configuration + +# Clear prev config +LOGGING_CONFIG = None + +# Get loglevel from env +LOGLEVEL = os.getenv('DJANGO_LOGLEVEL', 'info').upper() + +logging.config.dictConfig({ + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'console': { + 'format': '%(asctime)s %(levelname)s [%(name)s:%(lineno)s] %(module)s %(process)d %(thread)d %(message)s', + }, + }, + 'handlers': { + 'console': { + 'class': 'logging.StreamHandler', + 'formatter': 'console', + }, + }, + 'loggers': { + '': { + 'level': LOGLEVEL, + 'handlers': ['console',], + }, + }, +}) \ No newline at end of file diff --git a/backend/requirements.txt b/backend/requirements.txt index 6a8aae13..0c027f43 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -20,6 +20,7 @@ django-cors-headers==3.7.0 django-rest-auth==0.9.5 django-timezone-field==4.2.3 djangorestframework==3.12.4 +gunicorn==20.1.0 idna==3.2 kombu==5.2.4 oauthlib==3.1.1