Write log to file