[HttpKernel] tweaked logging in the exception listener
When there is no logger, we should only log critical errors (this is more sensible than the current behavior).
This commit is contained in:
parent
1a6c9b3143
commit
0a4250122f
@ -94,13 +94,14 @@ class ExceptionListener implements EventSubscriberInterface
|
|||||||
*/
|
*/
|
||||||
protected function logException(\Exception $exception, $message, $original = true)
|
protected function logException(\Exception $exception, $message, $original = true)
|
||||||
{
|
{
|
||||||
|
$isCritical = !$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500;
|
||||||
if (null !== $this->logger) {
|
if (null !== $this->logger) {
|
||||||
if (!$exception instanceof HttpExceptionInterface || $exception->getStatusCode() >= 500) {
|
if ($isCritical) {
|
||||||
$this->logger->crit($message);
|
$this->logger->crit($message);
|
||||||
} else {
|
} else {
|
||||||
$this->logger->err($message);
|
$this->logger->err($message);
|
||||||
}
|
}
|
||||||
} else {
|
} elseif (!$original || $isCritical) {
|
||||||
error_log($message);
|
error_log($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user