Write the log to a file