Write log to files