Author: grobmeier
Date: Mon Jun 15 19:33:30 2009
New Revision: 784933

URL: http://svn.apache.org/viewvc?rev=784933&view=rev
Log:
fixed bus error: reference returning done in getLogger method now. This returns 
the correct reference to the configurator. Precise problem unknown 

Modified:
    incubator/log4php/trunk/src/main/php/LoggerHierarchy.php
    incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php
    
incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorIniTest.php

Modified: incubator/log4php/trunk/src/main/php/LoggerHierarchy.php
URL: 
http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerHierarchy.php?rev=784933&r1=784932&r2=784933&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerHierarchy.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerHierarchy.php Mon Jun 15 
19:33:30 2009
@@ -131,7 +131,7 @@
         * @param LoggerFactory $factory a {...@link LoggerFactory} instance or 
null      
         * @return Logger
         */
-       public function getLogger($name, $factory = null) {
+       public function &getLogger($name, $factory = null) {
                if($factory === null) {
                        $factory = $this->defaultFactory;
                }
@@ -149,19 +149,21 @@
                                // if there is no father, set root logger as 
father
                                $this->ht[$name]->setParent($this->root);
                        } 
-                       
+               
                        // if there are more nodes than one
                        if(count($nodes) > 0) {
                                // find parent node
                                foreach($nodes as $node) {
                                        $parentNode = "$firstNode.$node";
                                        if(isset($this->ht[$parentNode]) and 
$parentNode != $name) {
+               
                                                
$this->ht[$name]->setParent($this->ht[$parentNode]);
                                        }
                                        $firstNode .= ".$node";
                                }
                        }
-               }                        
+               }               
+               
                return $this->ht[$name];
        } 
        

Modified: 
incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php
URL: 
http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php?rev=784933&r1=784932&r2=784933&view=diff
==============================================================================
--- 
incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php 
(original)
+++ 
incubator/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php 
Mon Jun 15 19:33:30 2009
@@ -112,7 +112,7 @@
         * @static
         */
        public static function configure($url = '') {
-               $configurator = new self();
+               $configurator = new LoggerConfiguratorIni();
                $repository = LoggerManager::getLoggerRepository();
                return $configurator->doConfigure($url, $repository);
        }
@@ -338,6 +338,7 @@
                }
                */
                
+               
                $thresholdStr = 
@$properties[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_THRESHOLD_PREFIX];
                
$hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, 
LoggerLevel::getLevelAll()));
                
@@ -428,7 +429,8 @@
                                } else if(strpos($key, 
LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX) === 0) {
                                        $loggerName = substr($key, 
strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX));
                                }
-                               $logger =& $hierarchy->getLogger($loggerName, 
$this->loggerFactory);
+                               
+                               $logger = $hierarchy->getLogger($loggerName, 
$this->loggerFactory);
                                        // synchronized(logger) {
                                        $this->parseCategory($props, $logger, 
$key, $loggerName, $value);
                                        $this->parseAdditivityForLogger($props, 
$logger, $loggerName);

Modified: 
incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorIniTest.php
URL: 
http://svn.apache.org/viewvc/incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorIniTest.php?rev=784933&r1=784932&r2=784933&view=diff
==============================================================================
--- 
incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorIniTest.php
 (original)
+++ 
incubator/log4php/trunk/src/test/php/configurators/LoggerConfiguratorIniTest.php
 Mon Jun 15 19:33:30 2009
@@ -29,11 +29,11 @@
                
        }
        
-       protected function tearDown() {
+       protected function xtearDown() {
                LoggerManager::resetConfiguration();
        }
         
-       public function xtestConfigure() {
+       public function testConfigure() {
                
LoggerConfiguratorIni::configure('configurators/test1.properties');
                $hierarchy = LoggerManager::getLoggerRepository();
                $root = $hierarchy->getRootLogger();
@@ -45,6 +45,11 @@
                
                $logger = $hierarchy->getLogger('mylogger');
                self::assertFalse($logger->getAdditivity());
+               
+               $logger2 = $hierarchy->getLogger('mylogger');
+               $logger2->setAdditivity(true);
+               self::assertTrue($logger2->getAdditivity());
+               self::assertTrue($logger->getAdditivity());
        }
        
        public function testConfigureWithRootCategory() {


Reply via email to