write logs to file