From 343004c4de332bfec09e8a57de775a46fecb18f9 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 16 Sep 2011 16:41:38 +0000 Subject: Fixed #16568 -- Added RequireDebugFalse filter to prevent sending 500 error emails when DEBUG is True in projects with no explicit LOGGING setting. Thanks to Andreas Pelme for report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16840 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/releases/1.4.txt | 3 +-- docs/topics/logging.txt | 13 +++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt index 90c5e24e9d..f12db2817b 100644 --- a/docs/releases/1.4.txt +++ b/docs/releases/1.4.txt @@ -593,8 +593,7 @@ to :class:`django.utils.log.AdminEmailHandler` to prevent admin error emails in 'filters': { 'require_debug_false': { - '()': 'django.utils.log.CallbackFilter', - 'callback': lambda r: not DEBUG + '()': 'django.utils.log.RequireDebugFalse' } }, 'handlers': { diff --git a/docs/topics/logging.txt b/docs/topics/logging.txt index f23b529d97..0175e8576f 100644 --- a/docs/topics/logging.txt +++ b/docs/topics/logging.txt @@ -504,8 +504,8 @@ Python logging module. Filters ------- -Django provides one log filter in addition to those provided by the -Python logging module. +Django provides two log filters in addition to those provided by the Python +logging module. .. class:: CallbackFilter(callback) @@ -516,14 +516,19 @@ Python logging module. through the filter. Handling of that record will not proceed if the callback returns False. +.. class:: RequireDebugFalse() + + .. versionadded:: 1.4 + + This filter will only pass on records when settings.DEBUG is False. + This filter is used as follows in the default :setting:`LOGGING` configuration to ensure that the :class:`AdminEmailHandler` only sends error emails to admins when :setting:`DEBUG` is `False`:: 'filters': { 'require_debug_false': { - '()': 'django.utils.log.CallbackFilter', - 'callback': lambda r: not DEBUG + '()': 'django.utils.log.RequireDebugFalse', } }, 'handlers': { -- cgit v1.3