protected function _initZFDebug()
    {
        if ((APPLICATION_ENV === 'production') || (APPLICATION_ENV === 'acceptance') || Zend_Session::$_unitTestEnabled ) {
            // Never on on production systems
            return;
        }

        $debug = $this->getOption('zfdebug');
        if (! isset($debug['activate']) || ('1' !== $debug['activate'])) {
            // Only turn on when activated
            return;
        }

        # Instantiate the database adapter and cache
        $this->bootstrap('db');
        $db = $this->getPluginResource('db');

        $this->bootstrap('cache');
        $cache = $this->cache;

        $options = array(
            'plugins' => array('Variables',
                'Database' => array('adapter' => $db->getDbAdapter()),
                'File'     => array('basePath' => GEMS_ROOT_DIR),
                'Cache'    => array('backend' => $cache->getBackend()),
                'Exception')
        );

        $debugPlugin = new \ZFDebug_Controller_Plugin_Debug($options);

        $this->bootstrap('frontController');
        $frontController = $this->getResource('frontController');
        $frontController->registerPlugin($debugPlugin);
    }