﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29991	Document logger propagation for the default logging config	George Tantiras	George Tantiras	"It is very helpful to make it clear in the docs how the Logger setup is structured. 

I managed to get the big picture with the following code which makes it very clear that the default handlers are applied to the parent 'django' logger, while all children (except django.server) propagate to their parent. 

That was not the default a few years ago and many sources claim that it is better to build a logger from scratch instead of trying to make ends meet with the obscure django default setup.

An example is [https://stackoverflow.com/questions/20282521/django-request-logger-not-propagated-to-root this S.O question:] 



The code that delineated the situation and made me trust django logging system, is the following:

{{{

$ ./manage.py shell

>>> import logging
>>> # Grub all Django loggers
>>> loggers = [
        name for name in logging.root.manager.loggerDict 
        if 'django' in name
    ]
>>> for each in loggers:
        logger = logging.getLogger(each)
        print(
            'Logger Name: {0}\nLogger Handlers: {1}\n'
            'Logger Propagates: {2}\n\n'.format(
                each, 
                logger.handlers, 
                logger.propagate
            )
        )
}}}

The results [https://stackoverflow.com/a/53496459/2996101 -as shown in this answer-] are in accordance with the [https://docs.python.org/3/library/logging.html#logging.Logger.propagate propagate docs]


    A common scenario is to attach handlers only to the root logger, and to let propagation take care of the rest.

Documenting this, will show that django logging system is neat, great and trustworthy. "	Cleanup/optimization	closed	Documentation	2.1	Normal	fixed	Logger		Ready for checkin	1	0	0	0	0	0
