Permalink
Browse files

Fixed #14264 -- Ensured settings.configure configures logging

Thanks Matt McDonald for the patch.
  • Loading branch information...
1 parent 4d817b3 commit 34162698cc7a3c75b1d1b2e18b481aa7e865dc98 @claudep claudep committed Nov 10, 2012
Showing with 19 additions and 1 deletion.
  1. +1 −0 django/conf/__init__.py
  2. +18 −1 tests/regressiontests/logging_tests/tests.py
View
@@ -83,6 +83,7 @@ def configure(self, default_settings=global_settings, **options):
for name, value in options.items():
setattr(holder, name, value)
self._wrapped = holder
+ self._configure_logging()
@property
def configured(self):
@@ -4,7 +4,7 @@
import logging
import warnings
-from django.conf import compat_patch_logging_config
+from django.conf import compat_patch_logging_config, LazySettings
from django.core import mail
from django.test import TestCase, RequestFactory
from django.test.utils import override_settings
@@ -302,3 +302,20 @@ def test_circular_dependency(self):
out, err = self.run_manage(['validate'])
self.assertNoOutput(err)
self.assertOutput(out, "0 errors found")
+
+
+def dictConfig(config):
+ dictConfig.called = True
+dictConfig.called = False
+
+
+class SettingsConfigureLogging(TestCase):
+ """
+ Test that calling settings.configure() initializes the logging
+ configuration.
+ """
+ def test_configure_initializes_logging(self):
+ settings = LazySettings()
+ settings.configure(
+ LOGGING_CONFIG='regressiontests.logging_tests.tests.dictConfig')
+ self.assertTrue(dictConfig.called)

0 comments on commit 3416269

Please sign in to comment.