Using python 'logging' when logging.root has been redefined (Kivy)

Viewed 1560

I've already seen Using Python logging in multiple modules and similar which recommend using:-

import logging
logger = logging.getLogger(__name__)

in every module. However I'm also using Kivy as a front-end, which has its own logging code. To summarise, Kivy's logging code sets logging.root to its own class.

What this means for me is that the handlers which Kivy assigns aren't inherited by my child modules.

How do I get around this? I've even tried manually assigning handlers as below:-

logging.getLogger(my.module.name).addHandler(handler)

and it still doesn't seem to show up in my console log. Obviously I'd prefer not to do the above once per module, as well.

EDIT

To clarify, I'd like to set up the Kivy app to be able to handle modules which use the 'recommended' log method, without any change to the module code.

1 Answers
Related