New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging ancestors ignored after configuration #46949
Comments
I am seeing some odd behaviour with logging which would be explained That's a bit abstract, so here's the problem itself: I define my log import logging
log = logging.getLogger(__name__) Now typically __name__ will be something like "acooke.utils.foo". That happens before the application configures logging, which it does If I do that, then I don't see any logging output from One way to handle this is to make creation of module-level Loggers Of course, there's a performance hit... For example: class Log(object):
def __init__(self, name):
super(Log, self).__init__()
self._name = name
self._lazy = None
def __getattr__(self, key):
if not self._lazy:
self._lazy = logging.getLogger(self._name)
return getattr(self._lazy, key) and then, in some module: from acooke.util.log import Log
log = Log(__name__)
[...]
class Foo(object):
def my_method(self):
log.debug("this works as expected") |
This is not a bug - it's by design, as I explained in my reply to your |
I'd think that it is a rather common situation where one wants to use |
Got more important things than this to worry about, but yes, original Also, isn't this a "won't fix" rather than an "invalid"? |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: