I am running a simple FastAPI application under uvicorn. The FastAPI code is this:
from fastapi import FastAPI
@app.post("/events")
def create_events():
print("entering create_events()")
raise Exception("an error")
I run the app:
uvicorn api.main:app --reload --log-level=debug
I now post to the endpoint using wget:
wget -O- --header='Content-Type:application/json' --post-file=/tmp/data.json http://127.0.0.1:8000/events
Not surprisingly, the wget returns a 500 Internal Server Error.
In the output of the terminal where I ran uvicorn I see this:
entering create_events()
In other web application contexts (Perl, Ruby on Rails, Python with Flask) if the server raises an unhandled exception I can see the error message on the server side somewhere: in a log file, on standard output, somewhere. But in this FastAPI/uvicorn application I cannot find any error message. I don't see it in the place where I ran the wget and I don't see it in the uvicorn terminal.
Where is the 500 error message logged/displayed?