Add a debug log when publishing fails to help debugging

Change-Id: I11d00233e564dfd71e9e78fe6b57f9311c4eb5f3