I am running a python code in a raspberry Pi. The code is supposed to last forever. However, after a few hours it crashes. Since it is running on a remote machine, I cannot see the message it gives during the crash.
How can I store this message on a file so I can see what was the problem? is this does autonomously in linux? or should I write some function to export the error during crash. How can I do that?