protected function commit()
    {
        $rr = false;
        if (is_file($this->file)) {
            $size = filesize($this->file);
            if ($size > self::MAXLOGSIZE) {
                if (is_file($this->file . '.1')) {
                    unlink($this->file . '.1');
                }
                rename($this->file, $this->file . '.1');
            }
        } else {
            $rr = true;
        }
        if (is_file('/var/log/jvs/' . APP_NAME . '.log')) {
            $size = filesize('/var/log/jvs/' . APP_NAME . '.log');
            if ($size > self::MAXLOGSIZE) {
                if (is_file('/var/log/jvs/' . APP_NAME . '.log.1')) {
                    unlink('/var/log/jvs/' . APP_NAME . '.log.1');
                }
                rename('/var/log/jvs/' . APP_NAME . '.log', '/var/log/jvs/' . APP_NAME . '.log.1');
            }
        } else {
            $rr = true;
        }
        $h = fopen($this->file, 'a+');
        if ($rr) {
            @chmod($this->file, 0666);
        }
        if ($h) {
            while (null !== ($line = array_shift($this->tabCache))) {
                $content = implode('  ---  ', $line) . PHP_EOL;
                fwrite($h, $content);
            }
            fclose($h);
        }
        if (is_dir('/var/log/jvs')) {
            $h = fopen('/var/log/jvs/' . APP_NAME . '.log', 'a+');
            while (null !== ($line = array_shift($this->tabBeat))) {
                $content = json_encode($line) . PHP_EOL;
                fwrite($h, $content);
            }
            fclose($h);
        }
        return $this;
    }