I am trying to format traceback into a single line in my fastAPI application, as the logs are getting distributed to different entries in cloudwatch/kibana. I have tried to use sys.excepthook
approach as mentioned in the accepted answer for this question. But am still getting the same way. Can we update sys
specific parameters like sys.excepthook
from the fastAPI code?
Asked
Active
Viewed 780 times
0

Downey J
- 1
- 3
-
https://stackoverflow.com/questions/21627429/flask-and-sys-excepthook – Downey J Oct 06 '21 at 16:31
-
Have you seen https://fastapi.tiangolo.com/tutorial/handling-errors/#install-custom-exception-handlers ? – MatsLindh Oct 06 '21 at 17:18
-
@MatsLindh I have seen that, as I have some python asycio scripts which use the same config from the application, I am trying to use sys.excepthook which will have effect in both places – Downey J Oct 07 '21 at 03:06