duplicate output in simple python logging configuration

Basically, when one of your child logger displays a message, it goes backwards in the hierarchy, and the parents are also logging the same thing.

To cancel that behavior, you can add this:

logger.propagate = False

Note: Your logger must have a name using a non-empty string, getLogger(‘my name’)

When it hits the child, it won’t hit the parent afterwards.
Here is some documentation about this behavior.

Leave a Comment