function ExceptionLoggingSubscriber::on403
Same name in other branches
- 9 core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php \Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber::on403()
- 10 core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php \Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber::on403()
- 11.x core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php \Drupal\Core\EventSubscriber\ExceptionLoggingSubscriber::on403()
Log 403 errors.
Parameters
\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event: The event to process.
File
-
core/
lib/ Drupal/ Core/ EventSubscriber/ ExceptionLoggingSubscriber.php, line 40
Class
- ExceptionLoggingSubscriber
- Log exceptions without further handling.
Namespace
Drupal\Core\EventSubscriberCode
public function on403(GetResponseForExceptionEvent $event) {
// Log the exception with the page where it happened so that admins know
// why access was denied.
$exception = $event->getException();
$error = Error::decodeException($exception);
unset($error['@backtrace_string']);
$error['@uri'] = $event->getRequest()
->getRequestUri();
$this->logger
->get('access denied')
->warning('Path: @uri. %type: @message in %function (line %line of %file).', $error);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.