diff options
| author | Neal Todd <neal.todd@torchbox.com> | 2015-11-07 17:22:30 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-11-18 09:56:30 -0500 |
| commit | e5430510ddabf0a434e49ab379de55e106e5e8a5 (patch) | |
| tree | 522ed9530da022f98a3994a3443210ab22bfb41a /docs | |
| parent | 7bbfc43e34c1909b8edfc8e3188c35447cffef15 (diff) | |
[1.9.x] De-emphasized use of NullHandler in logging docs.
NullHandler removed in 1.9; unused since Django 1.5.
Backport of b3acdeee502e961065bfcdb7673d7cf91ab5b283 from master
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/logging.txt | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/docs/topics/logging.txt b/docs/topics/logging.txt index b1bd67f833..d64db31aa0 100644 --- a/docs/topics/logging.txt +++ b/docs/topics/logging.txt @@ -315,15 +315,15 @@ Finally, here's an example of a fairly complex logging setup:: 'special': { '()': 'project.logging.SpecialFilter', 'foo': 'bar', - } + }, + 'require_debug_true': { + '()': 'django.utils.log.RequireDebugTrue', + }, }, 'handlers': { - 'null': { - 'level': 'DEBUG', - 'class': 'logging.NullHandler', - }, 'console': { - 'level': 'DEBUG', + 'level': 'INFO', + 'filters': ['require_debug_true'], 'class': 'logging.StreamHandler', 'formatter': 'simple' }, @@ -335,9 +335,8 @@ Finally, here's an example of a fairly complex logging setup:: }, 'loggers': { 'django': { - 'handlers': ['null'], + 'handlers': ['console'], 'propagate': True, - 'level': 'INFO', }, 'django.request': { 'handlers': ['mail_admins'], @@ -371,17 +370,18 @@ This logging configuration does the following things: message, plus the time, process, thread and module that generate the log message. -* Defines one filter -- ``project.logging.SpecialFilter``, - using the alias ``special``. If this filter required additional - arguments at time of construction, they can be provided as - additional keys in the filter configuration dictionary. In this - case, the argument ``foo`` will be given a value of ``bar`` when - instantiating the ``SpecialFilter``. +* Defines two filters: -* Defines three handlers: + * ``project.logging.SpecialFilter``, using the alias ``special``. If this + filter required additional arguments, they can be provided as additional + keys in the filter configuration dictionary. In this case, the argument + ``foo`` will be given a value of ``bar`` when instantiating + ``SpecialFilter``. - * ``null``, a NullHandler, which will pass any ``DEBUG`` (or - higher) message to ``/dev/null``. + * ``django.utils.log.RequireDebugTrue``, which passes on records when + :setting:`DEBUG` is ``True``. + +* Defines two handlers: * ``console``, a StreamHandler, which will print any ``DEBUG`` (or higher) message to stderr. This handler uses the ``simple`` output @@ -393,8 +393,7 @@ This logging configuration does the following things: * Configures three loggers: - * ``django``, which passes all messages at ``INFO`` or higher - to the ``null`` handler. + * ``django``, which passes all messages to the ``console`` handler. * ``django.request``, which passes all ``ERROR`` messages to the ``mail_admins`` handler. In addition, this logger is @@ -546,6 +545,11 @@ specific logger following this example: .. code-block:: python + 'handlers': { + 'null': { + 'class': 'logging.NullHandler', + }, + }, 'loggers': { 'django.security.DisallowedHost': { 'handlers': ['null'], |
