add log feature in sample code.