/** * Constructor * * @param integer $level initial log level */ public function __construct($level = null) { parent::__construct('root'); if ($level == null) { $level = Payone_Log4php_LoggerLevel::getLevelAll(); } $this->setLevel($level); }
/** * Build a config that the Log4php_Logger accepts * @return array */ protected function buildInternalConfig() { $fileName = $this->getConfigValue('filename'); $fileSize = $this->getConfigValue('max_file_size'); $fileCount = $this->getConfigValue('max_file_count'); $internalConfig = array('appenders' => array(self::LOGGER_APPENDER_NAME => array('name' => self::LOGGER_APPENDER_NAME, 'class' => 'Payone_Log4php_LoggerAppenderRollingFile', 'layout' => array('class' => 'Payone_Log4php_LoggerLayoutTTCC'), 'params' => array('file' => $fileName, 'append' => TRUE, 'maxFileSize' => $fileSize, 'maxBackupIndex' => $fileCount))), 'rootLogger' => array('level' => Payone_Log4php_LoggerLevel::getLevelAll(), 'appenders' => array(self::LOGGER_APPENDER_NAME))); return $internalConfig; }
/** * 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(Payone_Log4php_LoggerLevel::getLevelDebug()); $this->setThreshold(Payone_Log4php_LoggerLevel::getLevelAll()); $this->shutDown(); foreach ($this->loggers as $logger) { $logger->setLevel(null); $logger->setAdditivity(true); $logger->removeAllAppenders(); } $this->rendererMap->clear(); Payone_Log4php_LoggerAppenderPool::clear(); }