Commit 1398c931 authored by Shrikrishna Singh's avatar Shrikrishna Singh

Implement logging

This adds the logging functionality available
in Django to get the errors into log files,
which will help in debuging while running the
server locally.

Closes #58
parent 29c2fc4c
Pipeline #27735565 passed with stages
in 18 minutes and 58 seconds
......@@ -3,5 +3,6 @@ __pycache__/
node_modules/
static/components/
backend/data.json
backend/logs/*
.idea
*.pyc
......@@ -114,6 +114,47 @@ CACHES = {
}
}
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s',
},
},
'handlers': {
'default': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'logs/backend.log',
'maxBytes': 1024*1024*5, # 5 MB
'backupCount': 5,
'formatter': 'standard',
},
'request_handler': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': 'logs/django_request.log',
'maxBytes': 1024*1024*5, # 5 MB
'backupCount': 5,
'formatter': 'standard',
},
},
'loggers': {
'': {
'handlers': ['default'],
'level': 'DEBUG',
'propagate': True,
},
'django.request': {
'handlers': ['request_handler'],
'level': 'DEBUG',
'propagate': False,
},
}
}
# Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment