Built-in PHP Webserver: log requests before handling them

This commit is contained in:
Matias Griese 2018-10-12 12:13:59 +03:00
parent d848dcde5d
commit 776d1419c1
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,12 @@
# v1.6.0-beta.3
## mm/dd/2018
1. [](#improved)
* Call `onFatalException` event also on internal PHP errors
* Built-in PHP Webserver: log requests before handling them
1. [](#bugfix)
* Grav 1.6: Scheduler Fallback for never runs and Windows support [#2202](https://github.com/getgrav/grav/pull/2202)
# v1.6.0-beta.2
## 10/09/2018
@ -6,7 +15,6 @@
1. [](#improved)
* Added support for syslog and syslog facility logging (default: 'file')
* Improved usability of `System` configuration blueprint with side-tabs
* Call `onFatalException` event also on internal PHP errors
1. [](#bugfix)
* Fixed asset manager to not add empty assets when they don't exist in the filesystem
* Regression: Fixed asset manager methods with default legacy attributes

View File

@ -1,4 +1,5 @@
<?php
/**
* @package Grav.Core
*
@ -7,7 +8,7 @@
*/
if (PHP_SAPI !== 'cli-server') {
exit('This script cannot be run from browser. Run it from a CLI.');
die('This script cannot be run from browser. Run it from a CLI.');
}
$_SERVER['PHP_CLI_ROUTER'] = true;
@ -21,6 +22,6 @@ $_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR .
$_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR . 'index.php';
$_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR . 'index.php';
require 'index.php';
error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4);
require 'index.php';