[3.1.x] Fixed #32016 -- Clarified manual logging config docs.

Backport of 2a55431a56 from master
This commit is contained in:
Carlton Gibson 2020-09-22 09:52:15 +02:00
parent 1d7c4addbd
commit 2c629b37d5
1 changed files with 14 additions and 6 deletions

View File

@ -468,8 +468,15 @@ If you don't want to configure logging at all (or you want to manually
configure logging using your own approach), you can set configure logging using your own approach), you can set
:setting:`LOGGING_CONFIG` to ``None``. This will disable the :setting:`LOGGING_CONFIG` to ``None``. This will disable the
configuration process for :ref:`Django's default logging configuration process for :ref:`Django's default logging
<default-logging-configuration>`. Here's an example that disables Django's <default-logging-configuration>`.
logging configuration and then manually configures logging:
Setting :setting:`LOGGING_CONFIG` to ``None`` only means that the automatic
configuration process is disabled, not logging itself. If you disable the
configuration process, Django will still make logging calls, falling back to
whatever default logging behavior is defined.
Here's an example that disables Django's logging configuration and then
manually configures logging:
.. code-block:: python .. code-block:: python
:caption: settings.py :caption: settings.py
@ -479,10 +486,11 @@ logging configuration and then manually configures logging:
import logging.config import logging.config
logging.config.dictConfig(...) logging.config.dictConfig(...)
Setting :setting:`LOGGING_CONFIG` to ``None`` only means that the automatic Note that the default configuration process only calls
configuration process is disabled, not logging itself. If you disable the :setting:`LOGGING_CONFIG` once settings are fully-loaded. In contrast, manually
configuration process, Django will still make logging calls, falling back to configuring the logging in your settings file will load your logging config
whatever default logging behavior is defined. immediately. As such, your logging config must appear *after* any settings on
which it depends.
Django's logging extensions Django's logging extensions
=========================== ===========================