Be more resilient while transferring debug logs

Change-Id: Ic111ccaf1a9a867e1d25eac060d4c761a3e6726e