Closed Anuj-Gupta4 closed 1 week ago
Looks good!
Could you purposefully raise some exceptions to test this out & see what the logging format is like?
Temporarily adding raise Exception
in the try block should do it
@spwoodcock
{"text": "2024-11-18 07:45:47.942 | ERROR | app.auth.auth_routes:get_or_create_user:219 - Exception occurred: Self generated exception\nTraceback (most recent call last):\n\n File \"
This is a sample log that was generated locally using self generated exception in fmtm.json file. This portion of it is clear: File \"/opt/app/auth/auth_routes.py\", line 169, in get_or_create_user\n raise Exception(\"Self generated exception\")\n\nException: Self generated exception\n", "record": {"elapsed": {"repr": "0:00:11.706153", "seconds": 11.706153}, "exception": {"type": "Exception", "value": "Self generated exception", "traceback": true}, "extra": {"stack_info": true}, "file": {"name": "auth_routes.py", "path": "/opt/app/auth/auth_routes.py"}, "function": "get_or_create_user", "level": {"icon": "❌", "name": "ERROR", "no": 40}, "line": 219, "message": "Exception occurred: Self generated exception", "module": "auth_routes", "name": "app.auth.auth_routes"
Related Issue
Resolves #1756
Describe this PR
Replaced log.error with log.exception and included traceback information where exceptions are raised.
Checklist before requesting a review