Merge pull request #23092 from nextcloud/backport/23083/stable20

[stable20] Generate exception to log on php errors
This commit is contained in:
Roeland Jago Douma 2020-09-29 16:38:56 +02:00 committed by GitHub
commit 2e87668f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -88,12 +88,14 @@ class ErrorHandler {
return;
}
$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
public static function onAll($number, $message, $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]);
}
}