open(LOG,">>$logfile") || die "error opening $logfile for append: $!\n";