How to do not close console when crashing?

I need the console to stay open when the program crashes. Because not all the information that appears in the console is written in the log file. So I have no idea what the error is.
Any way to do this?
Thank you so much!!