Skip to content
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

Should only use log level higher than DEBUG with the handlers #18

Open
pchng opened this issue Apr 20, 2021 · 2 comments · May be fixed by #32
Open

Should only use log level higher than DEBUG with the handlers #18

pchng opened this issue Apr 20, 2021 · 2 comments · May be fixed by #32

Comments

@pchng
Copy link

pchng commented Apr 20, 2021

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.

@TheRealNoob
Copy link

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)

@abinba
Copy link

abinba commented Feb 2, 2023

Any updates on this issue?

kernc added a commit to kernc/python-logging-loki that referenced this issue May 5, 2023
@kernc kernc linked a pull request May 5, 2023 that will close this issue
simosho pushed a commit to waylayio/python-logging-loki that referenced this issue Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants