protected function ExceptionListener::logException

Logs an exception.

Parameters

\Exception $exception The original \Exception instance:

string $message The error message to log:

Boolean $original False when the handling of the exception thrown another exception:

1 call to ExceptionListener::logException()
ExceptionListener::onKernelException in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php, line 95

Class

ExceptionListener
ExceptionListener.

Namespace

Symfony\Component\HttpKernel\EventListener

Code

protected function logException(\Exception $exception, $message, $original = true) {
  $isCritical = !$exception instanceof HttpExceptionInterface || $exception
    ->getStatusCode() >= 500;
  $context = array(
    'exception' => $exception,
  );
  if (null !== $this->logger) {
    if ($isCritical) {
      $this->logger
        ->critical($message, $context);
    }
    else {
      $this->logger
        ->error($message, $context);
    }
  }
  elseif (!$original || $isCritical) {
    error_log($message);
  }
}