[FIXED JENKINS-16634] Do not fail to write a log file just because something deleted the parent directory. (cherry picked from commit afe17a4b)