You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/06/17 17:06:33 UTC
[airavata-django-portal] 01/02: AIRAVATA-2638 Default logging
config emails errors to admins
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit ed7851c70e8956a3cd42e9a0880a35b0f9bcaeb5
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Jun 17 13:05:24 2019 -0400
AIRAVATA-2638 Default logging config emails errors to admins
---
django_airavata/settings.py | 27 ++++++++++++++++++-
django_airavata/settings_local.py.sample | 46 +++++++++++++++-----------------
2 files changed, 48 insertions(+), 25 deletions(-)
diff --git a/django_airavata/settings.py b/django_airavata/settings.py
index 5ac118a..0eb6907 100644
--- a/django_airavata/settings.py
+++ b/django_airavata/settings.py
@@ -258,16 +258,41 @@ WEBPACK_LOADER = webpack_loader_util.create_webpack_loader_config()
LOGGING = {
'version': 1,
+ 'disable_existing_loggers': False,
+ 'filters': {
+ 'require_debug_false': {
+ '()': 'django.utils.log.RequireDebugFalse',
+ },
+ 'require_debug_true': {
+ '()': 'django.utils.log.RequireDebugTrue',
+ },
+ },
+ 'formatters': {
+ 'verbose': {
+ 'format': '[%(asctime)s %(name)s:%(lineno)d %(levelname)s] %(message)s'
+ },
+ },
'handlers': {
'console': {
'class': 'logging.StreamHandler',
+ 'formatter': 'verbose'
},
+ 'mail_admins': {
+ 'filters': ['require_debug_false'],
+ 'level': 'ERROR',
+ 'class': 'django.utils.log.AdminEmailHandler',
+ 'include_html': True,
+ }
},
'loggers': {
'django_airavata': {
- 'handlers': ['console'],
+ 'handlers': ['console', 'mail_admins'],
'level': 'DEBUG' if DEBUG else 'INFO'
},
+ 'root': {
+ 'handlers': ['console', 'mail_admins'],
+ 'level': 'WARNING'
+ }
},
}
diff --git a/django_airavata/settings_local.py.sample b/django_airavata/settings_local.py.sample
index f67b18d..8f2d55e 100644
--- a/django_airavata/settings_local.py.sample
+++ b/django_airavata/settings_local.py.sample
@@ -77,45 +77,43 @@ SHARING_API_SECURE = False
# Portal settings
PORTAL_TITLE = 'Django Airavata Gateway'
-# Logging configuration
+# Logging configuration. Uncomment following to override default log configuration
# LOGGING = {
# 'version': 1,
# 'disable_existing_loggers': False,
-# 'formatters': {
-# 'verbose': {
-# 'format': '[%(asctime)s %(name)s:%(lineno)d %(levelname)s] %(message)s'
-# },
-# },
# 'filters': {
+# 'require_debug_false': {
+# '()': 'django.utils.log.RequireDebugFalse',
+# },
# 'require_debug_true': {
# '()': 'django.utils.log.RequireDebugTrue',
# },
# },
+# 'formatters': {
+# 'verbose': {
+# 'format': '[%(asctime)s %(name)s:%(lineno)d %(levelname)s] %(message)s'
+# },
+# },
# 'handlers': {
# 'console': {
-# 'filters': ['require_debug_true'],
# 'class': 'logging.StreamHandler',
-# 'formatter': 'verbose',
-# 'level': 'DEBUG',
-# },
-# 'file': {
-# 'class': 'logging.FileHandler',
-# 'filename': 'django_airavata.log',
-# 'formatter': 'verbose',
+# 'formatter': 'verbose'
# },
+# 'mail_admins': {
+# 'filters': ['require_debug_false'],
+# 'level': 'ERROR',
+# 'class': 'django.utils.log.AdminEmailHandler',
+# 'include_html': True,
+# }
# },
# 'loggers': {
-# 'django': {
-# 'handlers': ['console', 'file'],
-# 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'),
-# },
-# 'airavata': {
-# 'handlers': ['console', 'file'],
-# 'level': 'DEBUG',
-# },
# 'django_airavata': {
-# 'handlers': ['console', 'file'],
-# 'level': 'DEBUG',
+# 'handlers': ['console', 'mail_admins'],
+# 'level': 'DEBUG' if DEBUG else 'INFO'
# },
+# 'root': {
+# 'handlers': ['console', 'mail_admins'],
+# 'level': 'WARNING'
+# }
# },
# }