@
kilishan,
I have never liked the idea of
NOT logging "production" errors and far prefer using PHP Native Error Reporting.
Utilising "production" CI_DEBUG (FALSE) setting:
File: CodeIgniter4/app/Config/Boot/production.php
Proposal:
File: CodeIgniter4/system/Debug/Exceptions.php
PHP Code:
// around line: 80
/**
* Responsible for registering the error, exception and shutdown
* handling of our application.
*
* @codeCoverageIgnore
*/
public function initialize()
{
# John - 2021-11-15 - MAYBE ACTIVATE CI4 Exception Handling
if(CI_DEBUG) : // OLD Script
set_exception_handler([$this, 'exceptionHandler']);
set_error_handler([$this, 'errorHandler']);
register_shutdown_function([$this, 'shutdownHandler']);
else: // NEW Script
error_reporting(E_ALL); // COULD BE SET IN production
$logFile = WRITEPATH . '/logs/log-' .date('Y-m-d') .'.log';
ini_set('error_log', $logFile);
// DEBUG/TEST PHP Native Error Reporting()
if( ! FALSE ) :
echo '<h3> JUST TESTING PHP NATIVE ERRORS </h3>';
echo '<h4> error_log ==> ' .ini_get('error_log') .'<h4>';
error_log("<br> 0 ==> JB ==> Testing ERROR PHP LOG: ".date('H:i:s'), 0);
echo '<pre style="line-height:2;">';
echo file_get_contents($logFile);
echo '<pre>';
die('<hr> File: ==> ' .__file__ .' : ' .__line__);
endif;
endif;
}
Anyone in favour of Raising a new Pull Request with the above amendments?