diff options
| author | Preston Holmes <preston@ptone.com> | 2012-11-16 16:50:50 -0800 |
|---|---|---|
| committer | Preston Holmes <preston@ptone.com> | 2012-11-16 17:07:38 -0800 |
| commit | 44046e8a38225067d4d0feac35367eeae133446a (patch) | |
| tree | d9b3fac853204f1bbd59e9809c8ca65ff481f7b4 /django/conf/__init__.py | |
| parent | b4a98e028adb5b32dcfa7384e46f57b28b43b684 (diff) | |
Fixed #18985 -- made DeprecationWarnings loud
Capture warnings in Python >= 2.7 and route through
console handler, which is subject to DEBUG==True
Thanks to dstufft for the idea, and claudep for initial patch
Diffstat (limited to 'django/conf/__init__.py')
| -rw-r--r-- | django/conf/__init__.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py index 4e6f0f9211..dec4cf9418 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -6,6 +6,7 @@ variable, and then from django.conf.global_settings; see the global settings fil a list of all possible variables. """ +import logging import os import time # Needed for Windows import warnings @@ -55,6 +56,15 @@ class LazySettings(LazyObject): """ Setup logging from LOGGING_CONFIG and LOGGING settings. """ + try: + # Route warnings through python logging + logging.captureWarnings(True) + # Allow DeprecationWarnings through the warnings filters + warnings.simplefilter("default", DeprecationWarning) + except AttributeError: + # No captureWarnings on Python 2.6, DeprecationWarnings are on anyway + pass + if self.LOGGING_CONFIG: from django.utils.log import DEFAULT_LOGGING # First find the logging configuration function ... |
