Move logfile initialization top and use `shopt -s execfail` for 0python so failures can be logged