diff --git a/django/conf/__init__.py b/django/conf/__init__.py index 1804c851bf..4e6f0f9211 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -83,6 +83,7 @@ class LazySettings(LazyObject): for name, value in options.items(): setattr(holder, name, value) self._wrapped = holder + self._configure_logging() @property def configured(self): diff --git a/tests/regressiontests/logging_tests/tests.py b/tests/regressiontests/logging_tests/tests.py index e40800efde..96f81981c6 100644 --- a/tests/regressiontests/logging_tests/tests.py +++ b/tests/regressiontests/logging_tests/tests.py @@ -4,7 +4,7 @@ import copy 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 @@ class SettingsConfigTest(AdminScriptTestCase): 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)