How to debug runtime crashes like OOM

I have a Gradio app that is running fine for the most part but sometimes it crashes (e.g. when loading another PyTorch model).

Unfortunately it looks like the logs disappear immediately from the UI when the app restarts, so I’m not seeing what goes wrong.

Aside from reproducing the error locally, is there a convenient way of recovering logs from container crashes somehow on Spaces?