protected function write($message, $level, array $parameters)
    {
        if ($this->enabled === false) {
            return null;
        }
        
        if ($this->log_request_identifier === null) {
            $this->log_request_identifier = "MISSING_REQUEST_ID";
        }

        $ExceptionToTrace = $message;
        if ($message instanceof \Exception) {
            $message = (string) $message; //casting to string will append exception name
        }
        
        $LogDate = ($this->getFactory()->buildDateTime(null, $this->getLogDateTimeZone()));
        $Filename = $this->getFilenameByLevel($level);

        if ($Filename->isFile() && $Filename->isWritable() === false) {
            return $LogDate;
        }

        $this->logRotate($Filename);
        
        $this->write_count++;
        $request_id = substr($this->log_request_identifier, 0, 6);
        $trace_id =  substr(md5(uniqid()), 0, 6);
        $write_count = $this->write_count;
        $id = "$request_id/$trace_id ($write_count)";

        $message = empty($parameters) === false ? vsprintf($message, $parameters) : $message;
        $message = $LogDate->format($this->getLogDateFormat())." ${id} ".$message;

        if ($ExceptionToTrace instanceof \Exception) {
            $trace = $ExceptionToTrace->getTraceAsString().$this->getPreviousTraceDump($ExceptionToTrace->getPrevious());
            if ($trace !== '') {
                $message .= "\n".$trace."\n";
            }
        }

        if (is_dir($Filename->getPath()) === false) {
            @mkdir($Filename->getPath(), 0775, true);
        }
        
        @error_log($message."\n", 3, $Filename->getPathname());
        
        return $LogDate;
    }