Actions
Feature #68785
closedLog Fatal Errors
Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Logging
Target version:
-
Start date:
2015-08-06
Due date:
% Done:
0%
Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:
Description
Currently the TYPO3 ErrorHandler does not log FatalErrors to the sys_log-table. This happens because FatalErrors stop script execution.
It is easy to log this errors, too, if you register a shutdown function, which checks error_get_last.
Add this code to the constructor of \TYPO3\CMS\Core\Error\ErrorHandler
register_shutdown_function(function() { $error = error_get_last(); if ($error['type'] & E_ERROR) { $this->handleError($error['type'], $error['message'], $error['file'], $error['line']); } });
The handleError method should be adjusted and also check for E_ERROR, not only E_USER_ERROR:
$errorLevels = array( E_ERROR => 'Fatal Error', E_WARNING => 'Warning', E_NOTICE => 'Notice', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error', E_DEPRECATED => 'Runtime Deprecation Notice' ); [...] switch ($errorLevel) { case E_ERROR: case E_USER_ERROR: case E_RECOVERABLE_ERROR: $severity = 2; break; case E_USER_WARNING: case E_WARNING: $severity = 1; break; default: $severity = 0; }
Actions