Collect request information to log it. This can help to solve a problem later.

@return string Requets information, for logging
344031
protected function getRequestInformation() {
		$postdata = '';
			
		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
			// build a request string
			$t = array();
			
			foreach ($_POST as $k => $v) {
				$t[] = $k . '=' . $v;
			}

			// make a one line string
			$postdata = preg_replace('![\n\r]!',"",implode('&',$t));
			
			// truncate if too long
			if (strlen($postdata) > 250) {
				$postdata = substr($postdata,0,250);
			}
		}

		// build a string with information about a request
		$requestinfo = ' '.getmypid() . "; " .
			basename($_SERVER['SCRIPT_FILENAME']) . "; " .
			$_SERVER['REMOTE_ADDR'] . "; " .
			$_SERVER['REQUEST_METHOD'] . "; " .
			$_SERVER['QUERY_STRING'] . "; " .
			$postdata . "; " .
			$_SERVER['HTTP_USER_AGENT'] . "; " .
			$_SERVER['HTTP_REFERER'];
		return $requestinfo;
	}
677315
public function collect()
    {
        /** @var Request $request */
        $request = $this->app['request'];

        $this->data = [
            '__meta' => [
                'id' => $this->getCurrentRequestId(),
                'datetime' => date('Y-m-d H:i:s'),
                'utime' => microtime(true),
                'method' => $request->getMethod(),
                'uri' => $request->getRequestUri(),
                'ip' => $request->getClientIp()
            ]
        ];

        foreach ($this->collectors as $name => $collector) {
            $this->data[$name] = $collector->collect();
        }

        // Remove all invalid (non UTF-8) characters
        array_walk_recursive(
            $this->data,
            function (&$item) {
                if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) {
                    $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8');
                }
            }
        );

        if ($this->storage !== null) {
            $this->storage->save($this->getCurrentRequestId(), $this->data);
        }

        return $this->data;
    }
997014
public function handleRequest()
    {
        $request = $this->prepareRequest();
        $version = $request['version'];
        $queryConfiguration = $request['queryConfiguration'];

        $data = $this->provider->process();
        return $version->createResponse($data, $queryConfiguration, $this->columnConfigurations);
    }
7669
public function collectData() {
		$userAgentsWithDeviceId = array();		
		foreach ($this->_userAgentHandlers as $userAgentHandler) {
			/**
			 * @see WURFL_Handlers_Handler::getUserAgentsWithDeviceId()
			 */
			$current = $userAgentHandler->getUserAgentsWithDeviceId();
			if(!empty($current)) {
				$userAgentsWithDeviceId = array_merge($userAgentsWithDeviceId, $current);
			} 
		}
		return $userAgentsWithDeviceId;
	}
389623
protected function handleRequest()
    {
        $message = $this->getMessage();

        if ($this->appId == self::TEST_APP_ID) {
            $response = $this->handleTestMessage($message);
        } else {
            $response = $this->handleMessage($message);
        }

        return [
            'to' => $message['FromUserName'],
            'from' => $message['ToUserName'],
            'response' => $response,
        ];
    }
773638
public function getRequestData()
    {
        parent::getRequestData();

        if ($this->getRequest() instanceof Request) {
            if (in_array($this->getRequest()->getMethod(), array('PUT', 'DELETE'))) {
                $this->requestData[$this->getRequest()->getMethod()] = $this->getRequest()->request->all();
            }
        }

        return $this->requestData;
    }
434276
public function log()
    {
        if (is_null($this->log)) {
            $this->log = app(Log::class);
        }

        return $this->log;
    }
869850
public function collect()
    {
        if (php_sapi_name() === 'cli') {
            $ip = gethostname();
            if ($ip) {
                $ip = gethostbyname($ip);
            } else {
                $ip = '127.0.0.1';
            }
            $request_variables = array(
                'method' => 'CLI',
                'uri' => isset($_SERVER['SCRIPT_FILENAME']) ? realpath($_SERVER['SCRIPT_FILENAME']) : null,
                'ip' => $ip
            );
        } else {
            $request_variables = array(
                'method' => isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null,
                'uri' => isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null,
                'ip' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null
            );
        }
        $this->data = array(
            '__meta' => array_merge(
                array(
                    'id' => $this->getCurrentRequestId(),
                    'datetime' => date('Y-m-d H:i:s'),
                    'utime' => microtime(true)
                ),
                $request_variables
            )
        );

        foreach ($this->collectors as $name => $collector) {
            $this->data[$name] = $collector->collect();
        }

        // Remove all invalid (non UTF-8) characters
        array_walk_recursive($this->data, function (&$item) {
                if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) {
                    $item = mb_convert_encoding($item, 'UTF-8', 'UTF-8');
                }
            });

        if ($this->storage !== null) {
            $this->storage->save($this->getCurrentRequestId(), $this->data);
        }

        return $this->data;
    }
1078865
protected function collectVisitData()
    {
        $request = $this->request;

        $user = $request->user();
        $userId = $user ? $user->getKey() : null;

        return [
            'user_id'              => $userId,
            'http_referer'         => $request->server('HTTP_REFERER'),
            'url'                  => $request->fullUrl(),
            'request_method'       => $request->method(),
            'request_path'         => $request->getPathInfo(),
            'http_user_agent'      => $request->server('HTTP_USER_AGENT'),
            'http_accept_language' => $request->server('HTTP_ACCEPT_LANGUAGE'),
            'locale'               => $this->app->getLocale(),
            'request_time'         => $request->server('REQUEST_TIME')
        ];
    }
925913
public function handleRequest(): self
    {
        if ($this->params->getBotParam('webhook.url')) {
            return $this->handleWebhook();
        }

        if ($loop_time = $this->getLoopTime()) {
            return $this->handleGetUpdatesLoop($loop_time, $this->getLoopInterval());
        }

        return $this->handleGetUpdates();
    }
437483
public function onRequest($req, $res)
    {
        $this->app->event->trigger('swoole.request');

        $this->resetOnRequest();

        /** @var Sandbox $sandbox */
        $sandbox = $this->app->make(Sandbox::class);
        $request = $this->prepareRequest($req);

        try {
            $sandbox->setRequest($request);

            $sandbox->init();

            $response = $sandbox->run($request);

            $this->sendResponse($sandbox, $response, $res);
        } catch (Throwable $e) {
            try {
                $exceptionResponse = $this->app
                    ->make(Handle::class)
                    ->render($request, $e);

                $this->sendResponse($sandbox, $exceptionResponse, $res);
            } catch (Throwable $e) {
                $this->logServerError($e);
            }
        } finally {
            $sandbox->clear();
        }
    }
183971
protected function handleRequest()
    {
        try {
            $request = $this->getRequest();
            if ($request->isParseError() === true) {
                throw new ParseErrorException();
            }
            $this->events->trigger('sendRequest.pre', $this, array('methode' => $request->getMethod()));
            if (($ret = $this->getParentHandle()) instanceof RPCERROR && ($ret = $ret->getData()) instanceof \Exception) {
                throw $ret;
            }
        } catch (AbstractException $e) {
            if(isset($this->options['log'])) {
                $this->container->get($this->options['log'])->err('(' . $e->getCode() . ') ' . $e->getMessage());
            }
            return $this->fault($e->getMessage(), $e->getCode());
        } catch (\Exception $e) {
            if(isset($this->options['log'])) {
                $this->container->get($this->options['log'])->err('(' . $e->getCode() . ') ' . $e->getMessage() . ' in ' . $e->getFile() . ' line ' . $e->getLine(), $e->getTrace());
            }
            return ((isset($this->options['environment']) && $this->options['environment'] === "dev")) ? $this->fault('(' . $e->getCode() . ') ' . $e->getMessage() . ' in ' . $e->getFile() . ' line ' . $e->getLine(), $e->getCode(), $e->getTrace()) : $this->fault('Internal error', RPCERROR::ERROR_INTERNAL);
        }
    }
1327646
public function toLogString()
    {
        $logParts = array();
        if ($this->getStatus() !== null) {
            $logParts[] = 'status=' . $this->getStatus();
        }
        if ($this->getRawRequest() !== null) {
            $logParts[] = 'request=' . $this->getRawRequest();
        }
        if ($this->getRawResponse() !== null) {
            $logParts[] = 'response=' . $this->getRawResponse();
        }
        if ($this->getException() !== null) {
            $logParts[] = $this->getException()->__toString();
        }
        return implode('; ', $logParts);
    }
1003730
public function getDataAction()
    {
        $request           = $this->getRequest();
        $dataCount         = 0;
        $dataFilteredCount = 0;
        $tableData         = array();
        $draw              = 0;
        if($request->isPost()) {

            $post           = get_object_vars($request->getPost());
            $columns        = array_keys($this->tool()->getColumns());
            $draw           = (int) $post['draw'];
            $selColOrder    = $columns[(int) $post['order'][0]['column']];
            $orderDirection = isset($post['order']['0']['dir']) ? strtoupper($post['order']['0']['dir']) : 'ASC';
            $searchValue    = isset($post['search']['value']) ? $post['search']['value'] : null;
            $searchableCols = $this->tool()->getSearchableColumns();
            $start          = (int) $post['start'];
            $length         = (int) $post['length'];

            $data              = $this->themeTable()->getData($searchValue, $searchableCols, $selColOrder, $orderDirection, $start, $length)->toArray();
            $dataCount         = $this->themeTable()->getTotalData();
            $dataFilteredCount = $this->themeTable()->getTotalFiltered();
            $tableData         = $data;

            for($ctr = 0; $ctr < count($tableData); $ctr++) {
                // apply text limits
                foreach($tableData[$ctr] as $vKey => $vValue) {
                    $tableData[$ctr][$vKey] = $this->tool()->limitedText($vValue, 80);
                }

                $tableData[$ctr]['DT_RowId'] = $tableData[$ctr]['pros_theme_id'];
            }
        }

        $response = [
            'draw'            => $draw,
            'data'            => $tableData,
            'recordsFiltered' => $dataFilteredCount,
            'recordsTotal'    => $dataCount
        ];

        return new JsonModel($response);
    }
366137
public function getUserInformation()
    {
        $deferred = new Deferred();

        $this->http->get(Options::replace(Endpoints::USER_INFO, ['id' => $this->userInfo['userId']]))->then(function ($json) use ($deferred) {
            $deferred->resolve($json);
        }, function ($e) use ($deferred) {
            $deferred->reject($e);
        });

        return $deferred->promise();
    }
46616
function request()
    {
        if (!$this->request) {
            $request = new HttpRequest( new BuildHttpRequest );
            $this->request = $request;
        }

        return $this->request;
    }
550794
public function actionRequest()
    {
        if (!$this->enablePasswordRecovery) {
            return $this->redirect(['/user/security/login']);
        }
        /** @var RecoveryForm $model */
        $model = new RecoveryForm(['scenario' => 'request']);
        if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
            Yii::$app->response->format = Response::FORMAT_JSON;
            return ActiveForm::validate($model);
        }
        if ($model->load(Yii::$app->request->post()) && $model->sendRecoveryMessage()) {
            return $this->redirect(['/user/recovery/request']);
        }
        return $this->render('request', ['model' => $model]);
    }