feat(log): Improve error logging (closes #5080)(closes #4816)