Improve logging of task failures