Problem/Motivation
It is not possible to find out that some users can experience issues related with server memory limit while just monitoring drupal logs. Why Drupal 7 does not log exceeding the allowed memory limit?
Steps to reproduce
1) create in the Drupal`s root folder file 'memoryCheck.php' with contents:
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
error_reporting(-1);
$conf['error_level'] = 2;
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
function exceedMemoryLimit() {
$data = '';
while(true) {
$data .= str_repeat('#', PHP_INT_MAX);
}
}
exceedMemoryLimit();
2) Open /memoryCheck.php throught browser
3) Open /admin/reports/dblog
Result: Not errors logged.
Proposed resolution
Log such errors inside _drupal_shutdown_function()