If the `disable_existing_loggers` key in the :setting:`LOGGING`
dictConfig is set to `True` (which is the default) the default
configuration is completely overridden.
That is **not right** and it is pretty painful to trace down that the
`django.request` and `django.security`, although disabled, don't propagate
to the root logger even when `disable_existing_loggers` in my LOGGING is
`True`. One would expect the disabling would allow the logger to propagate
again.
Many people apparently already ran into this.
There are Stack Overflow questions and blog posts about this topic. Best
of them I found is here: http://www.caktusgroup.com/blog/2015/01/27
/Django-Logging-Configuration-logging_config-default-settings-logger/
It suggests the working way to put to `settings` to **really erase the
default logging**. I think it should definitely be stated in the doc.
{{{
LOGGING_CONFIG = None
LOGGING = {...} # whatever you want
import logging.config
logging.config.dictConfig(LOGGING)
}}}
The logging system is complex by itself, something it is not a pleasure to
work with for many. The reset path eliminating the confusion would be most
welcome.
--
Ticket URL: <https://code.djangoproject.com/ticket/24361>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* easy: 1 => 0
* stage: Unreviewed => Accepted
Comment:
I'll be happy to review any patch you could draft. See also #23394 and
#23784.
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:1>
Comment (by Tuttle):
Thank you. Sending a draft.
(Sorry, if the markup is wrong. ReST can compete with the logging module
in opacity...)
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:2>
Comment (by Tuttle):
There is a neat module `logging_tree` by Brandon Rhodes on PyPi that can
be of tremendous help during understanding of the actual logger tree.
I don't know whether it could be considered to merge the module to Django,
but what if I send a patch mentionting this module in the `logging.txt`
doc?
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:3>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:4>
Comment (by timgraham):
I lightly edited your patch and
[https://github.com/django/django/pull/4362 created a pull request] so
others can offer their thoughts. I also [https://groups.google.com/d/topic
/django-developers/no2IhnRty68/discussion posted to django-developers] to
see if we can improve the state of logging in Django more generally.
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:5>
* stage: Accepted => Ready for checkin
Comment:
Looks good and makes sense.
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:6>
* stage: Ready for checkin => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:7>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"c633667da3605208ea5fc137f5322c599f48da69" c633667d]:
{{{
#!CommitTicketReference repository=""
revision="c633667da3605208ea5fc137f5322c599f48da69"
Fixed #24361 -- Clarified docs on reconfiguring logging.
Thanks Tuttle for the report and draft patch, and Carl Meyer for
help and review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:8>
Comment (by Tim Graham <timograham@…>):
In [changeset:"0dc986d1c8a3bfc7d9afdf9a8c28f39aaa101aac" 0dc986d1]:
{{{
#!CommitTicketReference repository=""
revision="0dc986d1c8a3bfc7d9afdf9a8c28f39aaa101aac"
[1.8.x] Fixed #24361 -- Clarified docs on reconfiguring logging.
Thanks Tuttle for the report and draft patch, and Carl Meyer for
help and review.
Backport of c633667da3605208ea5fc137f5322c599f48da69 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:9>
Comment (by Tim Graham <timograham@…>):
In [changeset:"0121fb814807763541245b3c131ccace3f18ac0e" 0121fb81]:
{{{
#!CommitTicketReference repository=""
revision="0121fb814807763541245b3c131ccace3f18ac0e"
[1.7.x] Fixed #24361 -- Clarified docs on reconfiguring logging.
Thanks Tuttle for the report and draft patch, and Carl Meyer for
help and review.
Backport of c633667da3605208ea5fc137f5322c599f48da69 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:10>
Comment (by Tim Graham <timograham@…>):
In [changeset:"4a06a904dcd27388ec9a3cfb2bc8a8421bb44816" 4a06a90]:
{{{
#!CommitTicketReference repository=""
revision="4a06a904dcd27388ec9a3cfb2bc8a8421bb44816"
Refs #24361 -- Corrected documented level of the 'django' logger.
The logger doesn't define an explicit level, therefore it defaults
to WARNING.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:11>
Comment (by Tim Graham <timograham@…>):
In [changeset:"8f42934f86c1c6dff9fb24fd6fadb9d72b89d7b6" 8f42934f]:
{{{
#!CommitTicketReference repository=""
revision="8f42934f86c1c6dff9fb24fd6fadb9d72b89d7b6"
[1.7.x] Refs #24361 -- Corrected documented level of the 'django' logger.
The logger doesn't define an explicit level, therefore it defaults
to WARNING.
Backport of 4a06a904dcd27388ec9a3cfb2bc8a8421bb44816 from stable/1.8.x
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24361#comment:12>