write log to logfile