logtail / logtail-python

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

Problem with Logtail in combination with Flask + APScheduler or Celery #7

Closed ChriZzn closed 1 year ago

ChriZzn commented 1 year ago

Hi together,

we are facing Problems when using logtail-python in Flask Projects, after Restarting Flask + Celery it works again for some days and then Falls back to the Same error. Can you Provide any solution for this?

` Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/apscheduler/executors/base.py", line 125, in run_job retval = job.func(*job.args, job.kwargs) File "/app/tasks/jobs.py", line 93, in health_check logger.error(f"Error at disabling all scanners due to update {str(e)}") File "/usr/local/lib/python3.9/logging/init.py", line 1475, in error self._log(ERROR, msg, args, kwargs) File "/usr/local/lib/python3.9/logging/init.py", line 1589, in _log self.handle(record) File "/usr/local/lib/python3.9/logging/init.py", line 1599, in handle self.callHandlers(record) File "/usr/local/lib/python3.9/logging/init.py", line 1661, in callHandlers hdlr.handle(record) File "/usr/local/lib/python3.9/logging/init.py", line 952, in handle self.emit(record) File "/usr/local/lib/python3.9/site-packages/logtail/handler.py", line 70, in emit raise e File "/usr/local/lib/python3.9/site-packages/logtail/handler.py", line 58, in emit self.flush_thread.start() File "/usr/local/lib/python3.9/threading.py", line 887, in start raise RuntimeError("threads can only be started once")

`

curusarn commented 1 year ago

Hi @ChriZzn,

Thank you for your report.

I have just released a new version v0.2.0 which should fix this issue.

Could you upgrade to v0.2.0 and let me know if you encounter any issues? 🙏

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.