setContainer Error When Registering an EventSubscriber Service
The problem is the logging line in getSubscribedEvents:

\Drupal::logger('debug')-&gt;debug('get sub events');


Drupal::logger queries the container for a service, but the container hasn't been set at the point the event subscriber discovery happens.

By the time the event handler is invoked, the container has been initialised, so the logging in checkForRedirection should work fine.