Handler registered with addHandler not logging extra keys added by append_keys #2261
-
I am trying logger to use 2 handlers.
When I added extra keys via append_keys, newly registered handlers are not logging extra keys.
Whats could be the issue? This is reproducible even with just 1 handler. If we register the handler while creating the logger itself, it works without any issues. When we explicitly register the handler, it does not work. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @nimish-salve! Thanks for opening this discussion. We can confirm this by sending the first logger to the standard output which is We already have an option in Powertools where you can reuse the same Logger instance, but it doesn't seem to work if you change the We need to hear @heitorlessa's opinion, he is the most expert person I know in the Python Logging library. He is away until the end of the week and can help us when he returns. |
Beta Was this translation helpful? Give feedback.
@leandrodamascena this related to this: #2320
addHandler
goes to the superclass instead ofself._logger
. We could make another PR to addaddHandler
until we find a way around mypy to honour proxying object getters to our private logger. Right now, we recommend customers to either pass a custom logger handler at the constructor (code below), or to use our.register_formatter
,.registered_handler
Bring your own handler docs section