private function loadFormatter(ContainerBuilder $container)
    {
        $definition = new Definition('Behat\Behat\Output\Statistics\PhaseStatistics');
        $container->setDefinition('output.junit.statistics', $definition);

        $definition = new Definition('Behat\Testwork\Output\NodeEventListeningFormatter', array(
            'junit',
            'Outputs the failures in JUnit compatible files.',
            array(
                'timer' => true,
            ),
            $this->createOutputPrinterDefinition(),
            new Definition('Behat\Testwork\Output\Node\EventListener\ChainEventListener', array(
                array(
                    new Reference(self::ROOT_LISTENER_ID),
                    new Definition('Behat\Behat\Output\Node\EventListener\Statistics\ScenarioStatsListener', array(
                        new Reference('output.junit.statistics')
                    )),
                    new Definition('Behat\Behat\Output\Node\EventListener\Statistics\StepStatsListener', array(
                        new Reference('output.junit.statistics'),
                        new Reference(ExceptionExtension::PRESENTER_ID)
                    )),
                    new Definition('Behat\Behat\Output\Node\EventListener\Statistics\HookStatsListener', array(
                        new Reference('output.junit.statistics'),
                        new Reference(ExceptionExtension::PRESENTER_ID)
                    )),
                ),
            )),
        ));
        $definition->addTag(OutputExtension::FORMATTER_TAG, array('priority' => 100));
        $container->setDefinition(OutputExtension::FORMATTER_TAG . '.junit', $definition);
    }