go to bug id or search bugs for
When you try to inlude a non existent file, in the log appear two similar entries.
[date] PHP Warning: require(non_existent_file): failed to open stream: No such file or directory in .../index.php on line 5
[date] PHP Fatal error: require(): Failed opening required 'non_existent_file' (include_path='...') in .../index.php on line 5
They are not exactly the same, so technically is a not a duplicate, but,
they point to the same error, is kinda redundant IMHO, and also a bit confusing
for the different error types, is just a Warning or Fatal error ?
Is clear that one error is because the 'stream' to be parsed is empty or non existent and the other is an error because of the language construct 'require'
does not have a valid file to include... Is not a bug, of course, that's why I am asking as a feature request to remove one of them, and let just one simpler entry, Ex: 'PHP Warning: file "xxx" not found, in file .../index.php, line 5'
Let only the Warning for instance since the included file may not be so important for the entire framework execution to be Fatal...
And if possible, PLEASE let us REMOVE THE TIMEZONE from the date of the logs...
preferably have a 'log_format = %H.%i.%s' in the php.ini settings
(Of course I know that we can have a custom error log system implemented, but...)
Also would be nice (for security reasons) to have the option to NOT LOG the full paths, and log only the path/files.php relative to the root
Add a Patch
Add a Pull Request
These are not duplicate errors, but as you mentioned the warning leads to the follow up fatal error. The reason why it stops here is you are using require(), whose stated feature contrary to include() is exactly stopping the execution if the file cannot be loaded/executed. So everything here is working as expected. With include you get a second warning and execution continues.
Since include/require both allow stream wrappers, it is important to have both error messages, because the different systems need to be able to report the problems they have.
Pull Request for your date format feature request: https://github.com/php/php-src/pull/3899
The following pull request has been associated:
Patch Name: Add new core INI setting "error_date_format" to customize date format
On GitHub: https://github.com/php/php-src/pull/3899
That is awesome ! Thank you
The logs (generally) are meant for the developers, and they should already know on that Continent/City is located the server (or servers), is kinda silly to have the logs full of useless information that only make the logs larger in size.
For instance the largest identifiers are 30 bytes long (America/Argentina/Buenos_Aires)...
a simple log with 1.000.000 lines is increased by 28+ MB only with that useless repetition, I know it doesn't seems too much and some can argue that the rotate
logs will use compression, etc, but...
And if we are talking about logs... I whould like to see another feature implemented...
(again, I know we can implement custom error logs)
and is, having the ability to log in a specified file format, json, csv, etc...
similar to error_log(sprintf('["%s","%s",%d,...]%s', date, ip, port, ..., PHP_EOL))
Using json/array format is easier to search within the logs specific dates, ips, etc,
with a simple isset(line[ x ]), in_array(ip), array_search(date), whatever...
and as bonus, for error_log, whould be nice to autocreate the path/file.log if does not exists.
Thank you, and thank you again Beberlei for the pull request
-Summary: Duplicate error log entries and date format not configurable
+Summary: Duplicate error log entries and configurable date format