write log to tempfile