The instructions should state that setLevel() should be called on the handlers (LokiHandler, LokiQueueHandler) with a level higher than DEBUG.
The reason is that the handlers eventually call/use code in urllib3, (to send the log messages to the Loki API) which itself generates log DEBUG messages. If the log handler processes these messages, it results in additional calls to the urllib3 code, which generates further log messages ad infinitum, potentially causing an infinite loop of log messages if the Python process is not terminated.
Ideally the handler should ignore log messages from any code it directly or indirectly calls, but for now you should always use setLevel() with something higher than logging.DEBUG on the handler.
you lose a little bit of functionality, but i got around this by setting urllib3 to just above debug
logging.getLogger('urllib3').setLevel(logging.INFO)
The instructions should state that
setLevel()
should be called on the handlers (LokiHandler
,LokiQueueHandler
) with a level higher thanDEBUG
.The reason is that the handlers eventually call/use code in
urllib3
, (to send the log messages to the Loki API) which itself generates log DEBUG messages. If the log handler processes these messages, it results in additional calls to theurllib3
code, which generates further log messages ad infinitum, potentially causing an infinite loop of log messages if the Python process is not terminated.Ideally the handler should ignore log messages from any code it directly or indirectly calls, but for now you should always use
setLevel()
with something higher thanlogging.DEBUG
on the handler.