public function onFailedEventLogToLogger(FailedEvent $event)
    {
        $context = array(
            'event.name' => $event->getLastEventName(),
        );

        $message = 'An unknown error occured.';
        $exception = $event->getException();
        if ($exception instanceof Exception) {
            $message = $exception->getMessage();
        }
        if ($exception instanceof TaskRuntimeException && $exception->getTask() instanceof EventSubscriberInterface) {
            $eventSubscriberClassName = get_class($exception->getTask());
            if (strrpos($eventSubscriberClassName, '\\') !== false) {
                $eventSubscriberClassName = substr($eventSubscriberClassName, strrpos($eventSubscriberClassName, '\\') + 1);
            }
            $context['event.task.name'] = $eventSubscriberClassName;
        }

        $this->logger->log(LogLevel::CRITICAL, $message, $context);
        if ($exception instanceof TaskCommandExecutionException && $exception->getProcessExecutionResult() instanceof ProcessExecutionResult) {
            $context['command.result'] = $exception->getProcessExecutionResult()->getOutput();
            $context['separator'] = "\n=================\n";

            $this->logger->log(LogLevel::DEBUG, "{separator} Command output:{separator}\n{command.result}{separator}", $context);
        }
    }