Write log file