Browse Source

Update logging - vystup i do konzole

remotes/origin/Galerie
Tomas Gavenciak 9 years ago
parent
commit
14efcbbe25
  1. 35
      mamweb/settings_common.py
  2. 3
      mamweb/settings_local.py
  3. 18
      mamweb/settings_prod.py
  4. 4
      mamweb/settings_test.py

35
mamweb/settings_common.py

@ -186,7 +186,42 @@ try:
except:
SECRET_KEY = '12345zmr_k53a*@f4q_+ji^o@!pgpef*5&8c7zzdqwkdlkj'
# Logging
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s: %(message)s'
},
},
'loggers': {
# Catch-all logger
'': {
'handlers': ['console'], # Add 'mail_admins' in prod (and test?)
'level': 'DEBUG',
},
},
'handlers': {
'console': {
'level': 'INFO', ## Set to 'DEBUG' in local (and test?)
'class': 'logging.StreamHandler',
'formatter': 'verbose',
},
'mail_admins': {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
'formatter': 'verbose',
},
},
}
# MaM specific

3
mamweb/settings_local.py

@ -36,3 +36,6 @@ DATABASES = {
}
}
# LOGGING
LOGGING['handlers']['console']['level'] = 'DEBUG'

18
mamweb/settings_prod.py

@ -60,20 +60,8 @@ CSRF_COOKIE_SECURE = True
# LOGGING = {
# 'version': 1,
# 'disable_existing_loggers': True,
# 'handlers': {
# 'console': {
# 'class': 'logging.StreamHandler',
# },
# },
# 'loggers': {
# 'django': {
# 'handlers': ['console'],
# 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
# },
# },
# }
# LOGGING
LOGGING['loggers']['']['handlers'].extend('mail_admins')

4
mamweb/settings_test.py

@ -50,7 +50,6 @@ import os
SERVER_EMAIL = 'mamweb-test-errors@mam.mff.cuni.cz'
ADMINS = [
('Petr Pecha', 'nejlepsitextovyeditorjevim@gmail.com'),
('Tomas Gavenciak', 'gavento@gmail.com'),
]
@ -59,5 +58,8 @@ ADMINS = [
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
# LOGGING
LOGGING['loggers']['']['handlers'].extend('mail_admins')

Loading…
Cancel
Save