added write log to file