Ensure logs are captured and displayed when tests fail

Change-Id: Ie0d59e6f8c2ffb0db3f350cee9eafe0dc3f16c0e