Created attachment 10975 [details] possible kelvin error log fix Errors (tracebacks) are not logged anymore For some reason only the 500 http error is logged but no traceback. That worked in the past. I'm not sure why it stopped working? I was able to get tracebacks back, by setting the log file explicitly. See the attached patch. How to reproduce: - Add an exception to one of the kelvin resources - Call the resource - Check /var/log/univention/ucsschool-kelvin-rest-api/http.log for a 500 error without a traceback
In 2019 I removed the root logger from getting written to disk. It was catching to much unrelated logs from all libraries. But that's to far in the past I guess... In version 0.18 uvicorn made a few changes to its logging. Maybe they moved certain messages from uvicorn.access to uvicron.error or changes the severity?
I think the problem is simply, that the unhandled_exception_handler() just adds the correlation ID, but does not log the error. This would probably fix it: diff --git kelvin-api/ucsschool/kelvin/main.py kelvin-api/ucsschool/kelvin/main.py index 377b9834..7f54c3ec 100644 --- kelvin-api/ucsschool/kelvin/main.py +++ kelvin-api/ucsschool/kelvin/main.py @@ -148,6 +148,7 @@ async def udm_exception_handler(request: Request, exc: UdmError) -> JSONResponse @app.exception_handler(Exception) async def unhandled_exception_handler(request: Request, exc: Exception) -> JSONResponse: """Add Correlation-ID to HTTP 500.""" + logger.exception(f"While responding to {request.method!s} {request.url!r}: {exc!s}") return await http_exception_handler( request, HTTPException(
https://git.knut.univention.de/univention/components/ucsschool-kelvin-rest-api/-/issues/29
has been qa't by carlos and merged already and will be released with 1.8.3
has just been released with 1.8.3