Clear log when a job is restarted

This resolves issue https://github.com/travis-ci/travis-ci/issues/1450.