public function testClear() { $map = new LoggerRendererMap(); $map->clear(); // This should clear the map and remove default renderers self::assertNull($map->getByClassName('Exception')); }
/** * Reset all values contained in this hierarchy instance to their * default. * * This removes all appenders from all loggers, sets * the level of all non-root loggers to <i>null</i>, * sets their additivity flag to <i>true</i> and sets the level * of the root logger to {@link LOGGER_LEVEL_DEBUG}. * * <p>Existing loggers are not removed. They are just reset. * * <p>This method should be used sparingly and with care as it will * block all logging until it is completed.</p> */ public function resetConfiguration() { $root = $this->getRootLogger(); $root->setLevel(LoggerLevel::getLevelDebug()); $this->setThreshold(LoggerLevel::getLevelAll()); $this->shutDown(); foreach ($this->loggers as $logger) { $logger->setLevel(null); $logger->setAdditivity(true); $logger->removeAllAppenders(); } $this->rendererMap->clear(); LoggerAppenderPool::clear(); }
/** * Reset all values contained in this hierarchy instance to their * default. * * This removes all appenders from all categories, sets * the level of all non-root categories to <i>null</i>, * sets their additivity flag to <i>true</i> and sets the level * of the root logger to {@link LOGGER_LEVEL_DEBUG}. Moreover, * message disabling is set its default "off" value. * * <p>Existing categories are not removed. They are just reset. * * <p>This method should be used sparingly and with care as it will * block all logging until it is completed.</p> */ function resetConfiguration() { $root =& $this->getRootLogger(); $root->setLevel(LoggerLevel::getLevelDebug()); $this->setThreshold(LoggerLevel::getLevelAll()); $this->shutDown(); $loggers =& $this->getCurrentLoggers(); $enumLoggers = sizeof($loggers); for ($i = 0; $i < $enumLoggers; $i++) { $loggers[$i]->setLevel(null); $loggers[$i]->setAdditivity(true); $loggers[$i]->setResourceBundle(null); } $this->rendererMap->clear(); }