Generate exception to log on php errors

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2020-09-29 08:54:53 +02:00 committed by backportbot[bot]
parent fb426c90b7
commit 05fa5e4d9e
1 changed files with 4 additions and 2 deletions

View File

@ -88,12 +88,14 @@ class ErrorHandler {
return; return;
} }
$msg = $message . ' at ' . $file . '#' . $line; $msg = $message . ' at ' . $file . '#' . $line;
self::$logger->error(self::removePassword($msg), ['app' => 'PHP']); $e = new \Error(self::removePassword($msg));
self::$logger->logException($e, ['app' => 'PHP']);
} }
//Recoverable handler which catch all errors, warnings and notices //Recoverable handler which catch all errors, warnings and notices
public static function onAll($number, $message, $file, $line) { public static function onAll($number, $message, $file, $line) {
$msg = $message . ' at ' . $file . '#' . $line; $msg = $message . ' at ' . $file . '#' . $line;
self::$logger->debug(self::removePassword($msg), ['app' => 'PHP']); $e = new \Error(self::removePassword($msg));
self::$logger->logException($e, ['app' => 'PHP', 'level' => 0]);
} }
} }