write error log in exception situation