function ExceptionLoggingSubscriber::on404

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php \Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber::on404()
  2. 8.9.x core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php \Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber::on404()
  3. 10 core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php \Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber::on404()

Log 404 errors.

Parameters

\Symfony\Component\HttpKernel\Event\ExceptionEvent $event: The event to process.

File

core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php, line 56

Class

ExceptionLoggingSubscriber
Log exceptions without further handling.

Namespace

Drupal\Core\EventSubscriber

Code

public function on404(ExceptionEvent $event) {
    $request = $event->getRequest();
    $this->logger
        ->get('page not found')
        ->warning('@uri', [
        '@uri' => $request->getRequestUri(),
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.