I am running a VM on Google Cloud Compute Engine with the following (MRE) script: #!/bin/bash set -e exec > /var/log/startup-script.log 2>&1 source /opt/env/bin/activate python3 main.py In some cases, the python script has failed with a long trace. When it does, the trace it truncated in the startup-script.log file. I can read the start of the trace, but not the end. This is making it difficult to debug the issue, obviously. My suspicion is that when the trace is long, the end of the Python process occurs before the the trace is fully captured and written. I could be wrong about this suspicion, and corrections are welcome. In any event, is there a way for me to assure that the trace is fully captured and written to the log file so that I can figure out why the python script failed? Continue reading...