# HG changeset patch # User durandn # Date 1471356258 -7200 # Node ID 1eb1d082b9cc85444c35ee98fe03dabcf3cf664a # Parent 6ae78ea513e8e260c3cef883d0a132f9d3f43a0a logging config diff -r 6ae78ea513e8 -r 1eb1d082b9cc src/iconolab/settings/__init__.py --- a/src/iconolab/settings/__init__.py Tue Aug 16 15:39:00 2016 +0200 +++ b/src/iconolab/settings/__init__.py Tue Aug 16 16:04:18 2016 +0200 @@ -10,7 +10,7 @@ https://docs.djangoproject.com/en/1.9/ref/settings/ """ -import os +import os, logging # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -81,6 +81,58 @@ ] +# Logging + +LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/log.txt")) +LOG_LEVEL = logging.DEBUG +LOGGING = { + 'version': 1, + 'disable_existing_loggers': True, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'formatters' : { + 'simple' : { + 'format': "%(asctime)s - %(levelname)s : %(message)s", + }, + 'semi-verbose': { + 'format': '%(levelname)s %(asctime)s %(module)s %(message)s' + }, + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + }, + 'stream_to_console': { + 'level': LOG_LEVEL, + 'class': 'logging.StreamHandler' + }, + 'file': { + 'level': LOG_LEVEL, + 'class': 'logging.FileHandler', + 'filename': LOG_FILE, + 'formatter': 'semi-verbose', + }, + }, + 'loggers': { + 'django.request': { + 'handlers': ['file'], + 'level': LOG_LEVEL, + 'propagate': True, + }, + 'iconolab': { + 'handlers': ['file'], + 'level': LOG_LEVEL, + 'propagate': True, + }, + } +} + + ROOT_URLCONF = 'iconolab.urls' TEMPLATES = [ diff -r 6ae78ea513e8 -r 1eb1d082b9cc src/iconolab/settings/dev.py.tmpl --- a/src/iconolab/settings/dev.py.tmpl Tue Aug 16 15:39:00 2016 +0200 +++ b/src/iconolab/settings/dev.py.tmpl Tue Aug 16 16:04:18 2016 +0200 @@ -57,6 +57,8 @@ 'notifications' ] + + COMMENTS_APP = "django_comments_xtd" COMMENTS_XTD_MODEL = "iconolab.models.IconolabComment" COMMENTS_XTD_FORM_CLASS = 'iconolab.forms.comments.IconolabCommentForm' @@ -115,6 +117,58 @@ } } +# Logging + +LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../../run/log/log.txt")) +LOG_LEVEL = logging.DEBUG +LOGGING = { + 'version': 1, + 'disable_existing_loggers': True, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'formatters' : { + 'simple' : { + 'format': "%(asctime)s - %(levelname)s : %(message)s", + }, + 'semi-verbose': { + 'format': '%(levelname)s %(asctime)s %(module)s %(message)s' + }, + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + }, + 'stream_to_console': { + 'level': LOG_LEVEL, + 'class': 'logging.StreamHandler' + }, + 'file': { + 'level': LOG_LEVEL, + 'class': 'logging.FileHandler', + 'filename': LOG_FILE, + 'formatter': 'semi-verbose', + }, + }, + 'loggers': { + 'django.request': { + 'handlers': ['file'], + 'level': LOG_LEVEL, + 'propagate': True, + }, + 'iconolab': { + 'handlers': ['file'], + 'level': LOG_LEVEL, + 'propagate': True, + }, + } +} + + # Haystack connection HAYSTACK_CONNECTIONS = { 'default': {