logtail / logtail-python

Better Stack Python client
https://betterstack.com/logs
Other
36 stars 10 forks source link

Cannot use the logger in a FastAPI application #12

Closed slavovthinks closed 1 year ago

slavovthinks commented 1 year ago

My issue is the same as the one from here: https://stackoverflow.com/questions/74605213/python-fastapi-uvicorn-external-logger-wont-work

slavovthinks commented 1 year ago

I made a bypass of the problem by patching handler._is_main_process = lambda: True Which is not an ideal process. You can see my full answer in the stackoverflow question. Im open to collab with the logtail devs to create a PR that will actually solve the problem but Im unsure what would be the best way to approach the problem

curusarn commented 1 year ago

Hi @slavovthinks,

I appreciate your patience! Thanks for reaching out.

We have stopped using _is_main_process in version v0.2.3, which should solve your issue.

Could you update to v0.2.3 and let me know if the issue persists? 🙏

Thanks again for your report and the workaround.

curusarn commented 1 year ago

I'm closing this since the issue was fixed and should no longer happen.

Feel free to reopen if you are still encountering the issue.