[Django] #30553: Misleading logging documentation about disable_existing_loggers default value

9 views
Skip to first unread message

Django

unread,
Jun 7, 2019, 8:34:10 AM6/7/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
darthdragon |
Type: | Status: new
Uncategorized |
Component: | Version: 2.2
Documentation | Keywords:
Severity: Normal | disable_existing_loggers logging
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
In the documentation it's stated that:

"If the disable_existing_loggers key in the LOGGING dictConfig is set to
True (which is the default) ..."

But we can see in
[https://github.com/django/django/blob/master/django/utils/log.py]
(master branch commit 10b44e4 at the time of writting) that it is set to
False instead:

{{{
...
DEFAULT_LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
...
}}}

Moving "(which is the default)" in the paragraph should be enough:

"If the disable_existing_loggers key in the LOGGING dictConfig is set to
True then all loggers from the default configuration will be disabled.
Disabled loggers are not the same as removed; the logger will still exist,
but will silently discard anything logged to it, not even propagating
entries to a parent logger. Thus you should be very careful using
'disable_existing_loggers': True; it’s probably not what you want.
Instead, you can set disable_existing_loggers to False (which is the
default) and redefine some or all of the default loggers; or you can set
LOGGING_CONFIG to None and handle logging config yourself."

--
Ticket URL: <https://code.djangoproject.com/ticket/30553>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 7, 2019, 9:02:48 AM6/7/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
disable_existing_loggers logging |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* version: 2.2 => master
* type: Uncategorized => Cleanup/optimization
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Thanks for the report, it seems that this note is incorrect since its
introduction in 095643e69145d6899313c518fdd39919c9a89908 because we
changed that in 72c65fea41a6a01f24e134e7627417d94746291a.

--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:1>

Django

unread,
Jun 7, 2019, 9:08:53 AM6/7/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
disable_existing_loggers logging |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

I think what's meant here is the default for **dictConfig** if
`disable_existing_loggers` isn't provided.

> If absent, this parameter defaults to `True`.

https://docs.python.org/3.7/library/logging.config.html#dictionary-schema-
details

I guess the point is that it's important to provide
`disable_existing_loggers: False` because often the default behaviour is
not what you want. (''Why aren't my loggers working?'' comes up a lot
because of this.)

For me, it'd be worth a rephrase to clarify this. (We see a lot of
confusions.)

--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:2>

Django

unread,
Jun 7, 2019, 9:12:20 AM6/7/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
disable_existing_loggers logging |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Yeah, it seems this kind of thought was exactly what led to #20981 in the
first place.

--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:3>

Django

unread,
Jun 7, 2019, 9:30:45 AM6/7/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
disable_existing_loggers logging |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by felixxm):

You're right I missed that in
[https://docs.python.org/3/library/logging.config.html#dictionary-schema-
details dictionary-schema-details].

--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:4>

Django

unread,
Jun 7, 2019, 10:21:53 AM6/7/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
disable_existing_loggers logging |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by darthdragon):

I think these two sentences are what may start the headache:

"By default, the LOGGING setting is merged with Django’s default logging
configuration using the following scheme.

If the disable_existing_loggers key in the LOGGING dictConfig is set to

True (which is the default) then all loggers from the default
configuration will be disabled. ...

Because even after reading it 10 times, if you have never looked to python
logging.config (and I didn't until today, shame on me), you may not
understand that also any loggers that may have been defined before are
also disabled.

And maybe clarifying in "Django’s default logging configuration", that the
default django loggers are added with disable_existing_loggers=False.

--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:5>

Django

unread,
Jun 9, 2019, 2:03:44 PM6/9/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: Swat009
Type: | Status: assigned

Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
disable_existing_loggers logging |
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Swat009):

* owner: nobody => Swat009
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:6>

Django

unread,
Jun 10, 2019, 2:55:48 AM6/10/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: Swatantra

Type: | Status: assigned
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
disable_existing_loggers logging |
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/11456 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:7>

Django

unread,
Jun 10, 2019, 5:51:05 AM6/10/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: Swatantra
Type: | Status: assigned
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
disable_existing_loggers logging |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 0 => 1


Comment:

As per comment on PR, I think the solution here should just clarify that
the "default" in question if that of `dictConfig`, rather than referring
to the value used by Django's `DEFAULT_LOGGING` during startup.

--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:8>

Django

unread,
Jun 10, 2019, 6:56:12 AM6/10/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: Swatantra
Type: | Status: assigned
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
disable_existing_loggers logging | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:9>

Django

unread,
Jun 10, 2019, 9:19:10 AM6/10/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: Swatantra
Type: | Status: closed

Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
disable_existing_loggers logging | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"03cd3d137e2c29484b020b9768a4741f1096be97" 03cd3d1]:
{{{
#!CommitTicketReference repository=""
revision="03cd3d137e2c29484b020b9768a4741f1096be97"
Fixed #30553 -- Clarified the default value of disable_existing_loggers.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:10>

Django

unread,
Jun 10, 2019, 9:19:38 AM6/10/19
to django-...@googlegroups.com
#30553: Misleading logging documentation about disable_existing_loggers default
value.
-------------------------------------+-------------------------------------
Reporter: darthdragon | Owner: Swatantra
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
disable_existing_loggers logging | checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"6dca3361670d5a92dbe0954515d63c1e9db7cbcb" 6dca3361]:
{{{
#!CommitTicketReference repository=""
revision="6dca3361670d5a92dbe0954515d63c1e9db7cbcb"
[2.2.x] Fixed #30553 -- Clarified the default value of
disable_existing_loggers.

Backport of 03cd3d137e2c29484b020b9768a4741f1096be97 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30553#comment:11>

Reply all
Reply to author
Forward
0 new messages