settings: fix new logging configuration

This commit is contained in:
Benjamin Dauvergne 2013-06-13 09:32:27 +02:00
parent 5acfe238f6
commit a08b62e0e1
3 changed files with 7 additions and 8 deletions

View File

@ -1,9 +1,8 @@
# vim:spell:spelllang=fr
# -*- encoding: utf-8 -*-
import os.path
import django.conf.global_settings as DEFAULT_SETTINGS
from logging.handlers import SysLogHandler
import logging
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), '..')
@ -226,7 +225,7 @@ CHANGE_EMAIL_FROM = INSCRIPTION_FROM_EMAIL
ALERTE_FROM = INSCRIPTION_FROM_EMAIL
VALIDATION_FROM = INSCRIPTION_FROM_EMAIL
def LOGGING_FUNC(root):
def LOGGING_FUNC(root, DEBUG):
return {
'version': 1,
'disable_existing_loggers': True,
@ -252,7 +251,7 @@ def LOGGING_FUNC(root):
'syslog': {
'level': 'DEBUG',
'class': 'entrouvert.logging.handlers.SysLogHandler',
'formatter': 'syslog_debug' if level == 'DEBUG' else 'syslog',
'formatter': 'syslog_debug' if DEBUG else 'syslog',
'facility': logging.handlers.SysLogHandler.LOG_LOCAL0,
'address': '/dev/log',
'max_length': 999,
@ -265,7 +264,7 @@ def LOGGING_FUNC(root):
'handlers': ['syslog', 'mail_admins'],
},
'': {
'level': 'INFO',
'level': 'DEBUG' if DEBUG else 'INFO',
'handlers': ['syslog', 'mail_admins'],
},
},

View File

@ -16,7 +16,7 @@ ADMINS = (
)
MANAGERS = ADMINS
LOGGING = LOGGING_FUNC(PROJECT_ROOT)
LOGGING = LOGGING_FUNC(PROJECT_ROOT, DEBUG)
try:
from local_settings_dev import *

View File

@ -14,7 +14,7 @@ ADMINS = (
)
MANAGERS = ADMINS
LOGGING = LOGGING_FUNC('/var/log/logement')
LOGGING = LOGGING_FUNC('/var/log/logement', DEBUG)
MEDIA_ROOT = '/var/lib/logement/media/'
STATIC_ROOT = '/var/lib/logement/static/'