Description
Describe your environment
No response
What happened?
The SDK LoggingHandler
can be initialized in a bad state by doing just handler = LoggingHandler()
.
When i do this:
from opentelemetry.sdk._logs import LoggingHandler
import logging
handler = LoggingHandler()
logging.getLogger().addHandler(handler)
logger1 = logging.getLogger("myapp.area1")
logger1.error("error !")
We end up in an endless recursive loop here and the program crashes.
It seems LoggingHandler
should require that a SDK LoggerProvider
is passed in, and not an API LoggerProvider
. ?
Right now if nothing is passed to the LoggingHandler
(like in my code above), it can default to the ProxyLoggerProvider
which is an API LoggerProvider and it causes that endless recursive call..
Also LoggingHandler
expects it’s provider to provide a resource here, which the API LoggerProvider does not have..
Aaron also mentioned that he ran into this and can probably provide more context on what exactly the issues are here and how to fix things
Steps to Reproduce
See above..
Expected Result
See above.
Actual Result
See above..
Additional context
No response
Would you like to implement a fix?
Yes