Author mariocj89
Recipients Oleg Serov, mariocj89, xtreak
Date 2019-05-27.19:16:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558984614.05.0.274456374352.issue29143@roundup.psfhosted.org>
In-reply-to
Content
Note that "handlers" cannot be disabled. This applies only to loggers.

Also, the following code shows that disabling the logger does indeed prevents all logs in emitted by that logger from appearing:

```
import logging

parent_handler = logging.StreamHandler()
child_handler = logging.StreamHandler()

parent_logger = logging.getLogger('parent')
child_logger = logging.getLogger('parent.child')

parent_logger.addHandler(parent_handler)
child_logger.addHandler(child_handler)

child_logger.disabled = True

child_logger.error("wops")
```

Trying to guess what happened, it might be that there was a child of the disabled logged and you saw the log trace expecting it was the child, example:

```
import logging

parent_handler = logging.StreamHandler()
child_handler = logging.StreamHandler()

parent_logger = logging.getLogger('parent')
child_logger = logging.getLogger('parent.child')
grandchild_logger = logging.getLogger('parent.child.grandchild')

parent_logger.addHandler(parent_handler)
child_logger.addHandler(child_handler)

child_logger.disabled = True

grandchild_logger.error("wops")
```

Note that disable does not affect how handlers across loggers are called. It only disables the logger and therefore prevents from emitting logs that are emitted directly through the disabled logger.

Might that be the case? Are you OK with closing this issue if so?
History
Date User Action Args
2019-05-27 19:16:54mariocj89setrecipients: + mariocj89, Oleg Serov, xtreak
2019-05-27 19:16:54mariocj89setmessageid: <1558984614.05.0.274456374352.issue29143@roundup.psfhosted.org>
2019-05-27 19:16:54mariocj89linkissue29143 messages
2019-05-27 19:16:53mariocj89create