public function configureServiceManager(ServiceManager $serviceManager)
    {
        $configs               = $serviceManager->get('Config');
        $configs['parameters'] = array_merge(array(
            "monolog.logger.class"                                                  => "PPI\Framework\Log\Logger",
            "monolog.gelf.publisher.class"                                          => "Gelf\MessagePublisher",
            "monolog.handler.stream.class"                                          => "Monolog\Handler\StreamHandler",
            "monolog.handler.group.class"                                           => "Monolog\Handler\GroupHandler",
            "monolog.handler.buffer.class"                                          => "Monolog\Handler\BufferHandler",
            "monolog.handler.rotating_file.class"                                   => "Monolog\Handler\RotatingFileHandler",
            "monolog.handler.syslog.class"                                          => "Monolog\Handler\SyslogHandler",
            "monolog.handler.null.class"                                            => "Monolog\Handler\NullHandler",
            "monolog.handler.test.class"                                            => "Monolog\Handler\TestHandler",
            "monolog.handler.gelf.class"                                            => "Monolog\Handler\GelfHandler",
            "monolog.handler.firephp.class"                                         => "Symfony\Bridge\Monolog\Handler\FirePHPHandler",
            "monolog.handler.chromephp.class"                                       => "Symfony\Bridge\Monolog\Handler\ChromePhpHandler",
            "monolog.handler.debug.class"                                           => "Symfony\Bridge\Monolog\Handler\DebugHandler",
            "monolog.handler.swift_mailer.class"                                    => "Monolog\Handler\SwiftMailerHandler",
            "monolog.handler.native_mailer.class"                                   => "Monolog\Handler\NativeMailerHandler",
            "monolog.handler.socket.class"                                          => "Monolog\Handler\SocketHandler",
            "monolog.handler.pushover.class"                                        => "Monolog\Handler\PushoverHandler",
            "monolog.handler.fingers_crossed.class"                                 => "Monolog\Handler\FingersCrossedHandler",
            "monolog.handler.fingers_crossed.error_level_activation_strategy.class" => "Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy",
        ), $configs['parameters']);

        $config             = $this->processConfiguration($configs, $serviceManager);
        $handlersToChannels = array();

        if (isset($config['handlers'])) {
            $handlers = array();

            foreach ($config['handlers'] as $name => $handler) {
                $handlers[$handler['priority']][] = array(
                    'id'       => $this->buildHandler($serviceManager, $configs['parameters'], $name, $handler),
                    'channels' => isset($handler['channels']) ? $handler['channels'] : null,
                );
            }

            $sortedHandlers = array();
            foreach ($handlers as $priorityHandlers) {
                foreach (array_reverse($priorityHandlers) as $handler) {
                    $sortedHandlers[] = $handler;
                }
            }

            foreach ($sortedHandlers as $handler) {
                if (!in_array($handler['id'], $this->nestedHandlers)) {
                    $handlersToChannels[$handler['id']] = $handler['channels'];
                }
            }
        }

        $loggerClass = $configs['parameters']['monolog.logger.class'];
        $serviceManager->setFactory('monolog.logger', function ($serviceManager) use ($loggerClass, $handlersToChannels) {
            $logger = new $loggerClass('app');
            foreach ($handlersToChannels as $handler => $channels) {
                $logger->pushHandler($serviceManager->get($handler));
            }

            return $logger;
        });
    }