added logger

This commit is contained in:
Esther Kleinhenz
2018-10-16 20:04:26 +02:00
parent 5dc4b05a8f
commit d01ed0085c
4 changed files with 61 additions and 8 deletions
+50 -1
View File
@@ -169,4 +169,53 @@ else:
'django.contrib.auth.backends.ModelBackend',
'mysite.ldap_backend.LdapBackend',
]
print(" --- Live stage --- ")
print(" --- Live stage --- ")
#Log Configuration
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
},
'handlers': {
'null': {
'level':'DEBUG',
'class':'logging.NullHandler',
},
'logfile': {
'level':'DEBUG',
'class':'logging.handlers.RotatingFileHandler',
'filename': os.path.join(BASE_DIR, 'log.txt'),
'maxBytes': 50000,
'backupCount': 2,
'formatter': 'standard',
},
'console':{
'level':'INFO',
'class':'logging.StreamHandler',
'formatter': 'standard'
},
},
'loggers': {
'django': {
'handlers':['console'],
'propagate': True,
'level':'WARN',
},
'django.db.backends': {
'handlers': ['console'],
'level': 'DEBUG',
'propagate': False,
},
'mysite': {
'handlers': ['console', 'logfile'],
'level': 'DEBUG',
},
}
}