write log in files