save log only on failure exit_code

Change-Id: I42fb236f5fd22e472b84aa6330676c818f6a25ea