public function setProperties($properties, $prefix)
 {
     $len = strlen($prefix);
     while (list($key, ) = each($properties)) {
         if (strpos($key, $prefix) === 0) {
             if (strpos($key, '.', $len + 1) > 0) {
                 continue;
             }
             $value = LoggerOptionConverter::findAndSubst($key, $properties);
             $key = substr($key, $len);
             if ($key == 'layout' and $this->obj instanceof LoggerAppender) {
                 continue;
             }
             $this->setProperty($key, $value);
         }
     }
     $this->activate();
 }
Пример #2
0
 /**
  * Parse the additivity option for a non-root category.
  *
  * @param array $props array of properties
  * @param Logger $cat
  * @param string $loggerName
  */
 private function parseAdditivityForLogger($props, Logger $cat, $loggerName)
 {
     $value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX . $loggerName, $props);
     // touch additivity only if necessary
     if (!empty($value)) {
         $additivity = LoggerOptionConverter::toBoolean($value, true);
         $cat->setAdditivity($additivity);
     }
 }
 /**
  * Parse the additivity option for a non-root category.
  *
  * @param array $props array of properties
  * @param Logger &$cat
  * @param string $loggerName
  */
 function parseAdditivityForLogger($props, &$cat, $loggerName)
 {
     $value = LoggerOptionConverter::findAndSubst(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ADDITIVITY_PREFIX . $loggerName, $props);
     LoggerLog::debug("LoggerPropertyConfigurator::parseAdditivityForLogger() " . "Handling " . LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ADDITIVITY_PREFIX . $loggerName . "=[{$value}]");
     // touch additivity only if necessary
     if (!empty($value)) {
         $additivity = LoggerOptionConverter::toBoolean($value, true);
         LoggerLog::debug("LoggerPropertyConfigurator::parseAdditivityForLogger() " . "Setting additivity for [{$loggerName}] to [{$additivity}]");
         $cat->setAdditivity($additivity);
     }
 }
 /**
  * Set the properites for the object that match the
  * <code>prefix</code> passed as parameter.
  *
  * @param array $properties An array containing keys and values.
  * @param string $prefix Only keys having the specified prefix will be set.
  */
 function setProperties($properties, $prefix)
 {
     LoggerLog::debug("LoggerOptionConverter::setProperties():prefix=[{$prefix}]");
     $len = strlen($prefix);
     while (list($key, ) = each($properties)) {
         if (strpos($key, $prefix) === 0) {
             if (strpos($key, '.', $len + 1) > 0) {
                 continue;
             }
             $value = LoggerOptionConverter::findAndSubst($key, $properties);
             $key = substr($key, $len);
             if ($key == 'layout' && is_a($this->obj, 'loggerappender')) {
                 continue;
             }
             $this->setProperty($key, $value);
         }
     }
     $this->activate();
 }