In Python3 an explicit flush seems needed to make stacktraces appear in the log file (ATR-20897).
flush