{{{
import logging
logger = logging.getLogger(__name__)
logger.info("info")
logger.warning("warning")
logger.error("error")
logger.critical("critical")
}}}
And the output in the console:
{{{
warning
error
critical
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27931>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> [https://docs.djangoproject.com/en/1.10/topics/logging/#django-s-default-
> logging-configuration Django docs] state that, when `DEBUG = True`, all
> log messages INFO or higher should go to the console. However, it appears
> that the level is actually WARN or higher:
>
> {{{
> import logging
> logger = logging.getLogger(__name__)
>
> logger.info("info")
> logger.warning("warning")
> logger.error("error")
> logger.critical("critical")
> }}}
>
> And the output in the console:
> {{{
> warning
> error
> critical
> }}}
New description:
[https://docs.djangoproject.com/en/1.10/topics/logging/#django-s-default-
logging-configuration Django docs] state that, when `DEBUG = True`, all
log messages INFO or higher should go to the console. However, it appears
that the level is actually WARN or higher:
{{{
#!python
import logging
logger = logging.getLogger(__name__)
logger.info("info")
logger.warning("warning")
logger.error("error")
logger.critical("critical")
}}}
And the output in the console:
{{{
warning
error
critical
}}}
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:1>
Comment (by Paweł Adamczak):
Is it considered a documentation error/typo, or is documentation correct
here and the code should be updated to reflect it?
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:2>
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
This looks like a misunderstanding of how logging works. "The django
catch-all logger" only processes messages in the "django" namespace. For
example, this will log the message:
{{{
import logging
logger = logging.getLogger('django')
logger.info("info")
}}}
It's not the Django's documentation to do a comprehensive explanation of
Python logging, but some improvement might be possible.
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:3>
* cc: vedran@… (added)
* status: new => assigned
* owner: nobody => Vedran Karačić
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:4>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:5>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:6>
* cc: vedran@… (removed)
* owner: Vedran Karačić => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:7>
* owner: (none) => Barry Martin
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:8>
* needs_better_patch: 1 => 0
Comment:
[https://github.com/django/django/pull/8901 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:9>
* status: new => closed
* owner: (none) => Tim Graham <timograham@…>
* resolution: => fixed
Comment:
In [changeset:"f21915bb3ad73001b7d987332b2b4a0ae4ec288d" f21915bb]:
{{{
#!CommitTicketReference repository=""
revision="f21915bb3ad73001b7d987332b2b4a0ae4ec288d"
Fixed #27931 -- Clarified the meaning of "django catch-all logger."
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/27931#comment:10>