1
0
Fork 0

Add opbeat logging

merge-requests/26/head
Nikos Roussos 2015-07-17 20:22:07 +03:00
parent 5cae7503cb
commit 8e546dae71
3 changed files with 31 additions and 7 deletions

View File

@ -1,7 +1,6 @@
from os import path, getenv from os import path, getenv
BASE_DIR = path.dirname(path.dirname(__file__)) BASE_DIR = path.dirname(path.dirname(__file__))
# Apps # Apps
DJANGO_APPS = ( DJANGO_APPS = (
'django.contrib.auth', 'django.contrib.auth',
@ -116,24 +115,49 @@ LOGIN_REDIRECT_URL = 'home'
LOGGING = { LOGGING = {
'version': 1, 'version': 1,
'disable_existing_loggers': False, 'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s: [%(asctime)s] %(module)s - %(process)d %(thread)d - %(message)s'
},
},
'filters': { 'filters': {
'require_debug_false': { 'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse' '()': 'django.utils.log.RequireDebugFalse'
} }
}, },
'handlers': { 'handlers': {
'mail_admins': { 'console': {
'level': 'ERROR', 'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
},
'opbeat': {
'level': 'WARNING',
'filters': ['require_debug_false'], 'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler' 'class': 'opbeat.contrib.django.handlers.OpbeatHandler',
} },
}, },
'loggers': { 'loggers': {
'django.request': { 'django.request': {
'handlers': ['mail_admins'], 'handlers': ['opbeat'],
'level': 'ERROR', 'level': 'ERROR',
'propagate': True, 'propagate': True,
}, },
'django.db.backends': {
'level': 'ERROR',
'handlers': ['opbeat'],
'propagate': False,
},
'db': {
'level': 'WARNING',
'handlers': ['opbeat'],
'propagate': False,
},
'opbeat.errors': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
} }
} }

View File

@ -5,6 +5,7 @@ django-shortuuidfield==0.1.2
# Configuration # Configuration
django_dotenv==1.3.0 django_dotenv==1.3.0
dj-database-url==0.3.0 dj-database-url==0.3.0
opbeat==3.0.1
# Security # Security
django-braces==1.4.0 django-braces==1.4.0

View File

@ -3,4 +3,3 @@
MySQL-python==1.2.5 MySQL-python==1.2.5
gunicorn==19.3.0 gunicorn==19.3.0
opbeat==3.0.1