write log into file