Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #14264 -- Ensured settings.configure configures logging

Thanks Matt McDonald for the patch.
  • Loading branch information...
commit 34162698cc7a3c75b1d1b2e18b481aa7e865dc98 1 parent 4d817b3
@claudep claudep authored
View
1  django/conf/__init__.py
@@ -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):
View
19 tests/regressiontests/logging_tests/tests.py
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.