private function logWriteFile()
    {
        $cfg = $this->form->cfg;
        $file = $cfg['logFile'];
        $keys = \array_column($this->columns, 'key');
        $values = \array_column($this->columns, 'values');
        $appendFile = false;
        $keyCounts = array();       // for indexing keys of same name
        foreach ($keys as $k => $key) {
            $key = \trim(\strtolower($key));
            if (!isset($keyCounts[$key])) {
                $keyCounts[$key] = 1;
            } else {
                $keyCounts[$key]++;
                $key .= ' '.$keyCounts[$key];
            }
            $keys[$k] = $key;
        }
        if (\file_exists($file)) {
            $this->debug->log('log exists');
            // check that the keys in file match the data we're writing
            $handle = \fopen($file, 'rb');
            $keysExisting = \fgetcsv($handle, 4096, $cfg['logDelimitter']);
            \fclose($handle);
            if ($keysExisting === $keys) {
                $appendFile = true;
            }
        } else {
            $this->debug->log($file.' does not exist');
        }
        if ($appendFile) {
            $appendString = ArrayUtil::implodeDelim($values, $cfg['logDelimitter']);
            $return = FileIo::safeFileAppend($file, $appendString);
        } else {
            $rows = FileIo::readDelimFile($file);
            $rows[] = \array_combine($keys, $values);
            $return = FileIo::writeDelimFile($file, $rows, array(
                'char' => $cfg['log_delimitter']
            ));
        }
        return $return;
    }