Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2.0
    • Component/s: None
    • Labels:
    • Environment:

      Linux

      Description

      The following log4php errors show up during the HipHop build:

      "UnknownClass":[

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderMongoDB.php",119,23,119,76] ,"d":"new Mongo(sprintf('%s:%d', $this->host, $this->port))" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderMongoDB.php",160,19,160,63] ,"d":"new MongoDate($timestampSec, $timestampUsec)" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/helpers\/LoggerPatternParser.php",309,12,309,104] ,"d":"new LoggerUserFieldPatternConverter($this->formattingInfo, (string)ord($cNext) - 48)" }

      ]

      "UnknownObjectMethod":[

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderMongoDB.php",120,26,120,57] ,"d":"$this->connection->selectDB($this->databaseName)" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderMongoDB.php",122,69,122,69] ,"d":"$db->authenticate($this->userName, $this->password)" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderMongoDB.php",128,67,128,67] ,"d":"$db->selectCollection($this->collectionName)" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderMongoDB.php",145,20,145,39] ,"d":"$this->collection->insert($document)" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderMongoDB.php",198,61,198,61] ,"d":"$ex->getPrevious()" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderMongoDB.php",199,71,199,71] ,"d":"$ex->getPrevious()" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/renderers\/LoggerRendererException.php",34,59,34,59] ,"d":"$o->getPrevious()" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/renderers\/LoggerRendererException.php",35,67,35,67] ,"d":"$o->getPrevious()" }

      ]

      "UnknownFunction":[

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/Logger.php",25,0,25,50] ,"d":"spl_autoload_register(array('Logger', 'autoload'))" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderAdodb.php",122,15,122,44] ,"d":"adonewconnection($this->type)" }

      ,

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderSocket.php",188,2,188,17] ,"d":"parent::reset()" }

      ]

      "RequiredAfterOptionalParam":[

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/configurators\/LoggerConfiguratorXml.php",138,30,138,68] ,"d":"LoggerHierarchy $repository" }

      ]

      "UseVoidReturn":[

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/LoggerReflectionUtils.php",52,54,52,54] ,"d":"$pSetter->setProperties($properties, $prefix)" }

      ]

      "UseUndeclaredConstant":[

      {"c1": ["\/var\/lib\/tomcat6\/webapps\/hudson\/jobs\/Rontgen\/workspace\/lib\/log4php\/appenders\/LoggerAppenderAdodb.php",22,13,22,22] ,"d":"ADODB_DIR" }

      ]

      Please suggest a way to fix them, or if it's not fixable in the released version, please fix them in the to-be-released version.

      Thanks

        Activity

        Hide
        Ivan Habunek added a comment -

        Hi,

        Since there's a lot of code here, I will mark my answers with a asterisk and they will be below the line I'm commenting on.

        "UnknownClass":
        ["log4php/appenders/LoggerAppenderMongoDB.php",119,23,119,76] ,"d":"new Mongo(sprintf('%s:%d', $this->host, $this->port))"
        ["log4php/appenders/LoggerAppenderMongoDB.php",160,19,160,63] ,"d":"new MongoDate($timestampSec, $timestampUsec)"

        ["log4php/helpers/LoggerPatternParser.php",309,12,309,104] ,"d":"new LoggerUserFieldPatternConverter($this->formattingInfo, (string)ord($cNext) - 48)"

        • The issue with LoggerUserFieldPatternConverter was resolved in LOG4PHP-148.

        "UnknownObjectMethod":
        ["log4php/appenders/LoggerAppenderMongoDB.php",120,26,120,57] ,"d":"$this->connection->selectDB($this->databaseName)"
        ["log4php/appenders/LoggerAppenderMongoDB.php",122,69,122,69] ,"d":"$db->authenticate($this->userName, $this->password)"
        ["log4php/appenders/LoggerAppenderMongoDB.php",128,67,128,67] ,"d":"$db->selectCollection($this->collectionName)"
        ["log4php/appenders/LoggerAppenderMongoDB.php",145,20,145,39] ,"d":"$this->collection->insert($document)"

        • You need the MongoDB extension

        ["log4php/appenders/LoggerAppenderMongoDB.php",198,61,198,61] ,"d":"$ex->getPrevious()"
        ["log4php/appenders/LoggerAppenderMongoDB.php",199,71,199,71] ,"d":"$ex->getPrevious()"
        ["log4php/renderers/LoggerRendererException.php",34,59,34,59] ,"d":"$o->getPrevious()"
        ["log4php/renderers/LoggerRendererException.php",35,67,35,67] ,"d":"$o->getPrevious()"

        • The Exception::getPrevious() method was added in PHP 5.3, you are presumably using 5.2.

        "UnknownFunction":
        ["log4php/Logger.php",25,0,25,50] ,"d":"spl_autoload_register(array('Logger', 'autoload'))"

        • The method Logger::autoload() exists, I don't know why it raises an error.

        ["log4php/appenders/LoggerAppenderAdodb.php",122,15,122,44] ,"d":"adonewconnection($this->type)"

        ["log4php/appenders/LoggerAppenderSocket.php",188,2,188,17] ,"d":"parent::reset()"

        • This is an error. The parent class has no reset method. I will remove this method call.

        "RequiredAfterOptionalParam":
        ["log4php/configurators/LoggerConfiguratorXml.php",138,30,138,68] ,"d":"LoggerHierarchy $repository"

        • This is an error, the optional parameter should never come before the required ones. It will be fixed.

        "UseVoidReturn":
        ["log4php/LoggerReflectionUtils.php",52,54,52,54] ,"d":"$pSetter->setProperties($properties, $prefix)"

        • I suppose the problem is that setProperties returns null, and that null is used (returned). Can you try to remove the return keyword from line 52, and see if this fixed the problem? Just do this:
        • return $pSetter->setProperties($properties, $prefix);
          + $pSetter->setProperties($properties, $prefix);

        "UseUndeclaredConstant":
        ["log4php/appenders/LoggerAppenderAdodb.php",22,13,22,22] ,"d":"ADODB_DIR"

        • I will add a check to see if ADODB_DIR is defined before using it. This should solve the issue.

        Note that the LoggerAppenderAdodb class is deprecated. I will discuss removing it from the code base, since it has been marked deprecated for a long while. This will solve all adodb related issues.

        Hope this helps.

        Best regards,
        Ivan

        Show
        Ivan Habunek added a comment - Hi, Since there's a lot of code here, I will mark my answers with a asterisk and they will be below the line I'm commenting on. "UnknownClass": ["log4php/appenders/LoggerAppenderMongoDB.php",119,23,119,76] ,"d":"new Mongo(sprintf('%s:%d', $this->host, $this->port))" ["log4php/appenders/LoggerAppenderMongoDB.php",160,19,160,63] ,"d":"new MongoDate($timestampSec, $timestampUsec)" For Mongo and MongoDate, you need to have the MongoDB extnesion loaded. It can be found here: http://www.mongodb.org/display/DOCS/PHP+Language+Center ["log4php/helpers/LoggerPatternParser.php",309,12,309,104] ,"d":"new LoggerUserFieldPatternConverter($this->formattingInfo, (string)ord($cNext) - 48)" The issue with LoggerUserFieldPatternConverter was resolved in LOG4PHP-148 . "UnknownObjectMethod": ["log4php/appenders/LoggerAppenderMongoDB.php",120,26,120,57] ,"d":"$this->connection->selectDB($this->databaseName)" ["log4php/appenders/LoggerAppenderMongoDB.php",122,69,122,69] ,"d":"$db->authenticate($this->userName, $this->password)" ["log4php/appenders/LoggerAppenderMongoDB.php",128,67,128,67] ,"d":"$db->selectCollection($this->collectionName)" ["log4php/appenders/LoggerAppenderMongoDB.php",145,20,145,39] ,"d":"$this->collection->insert($document)" You need the MongoDB extension ["log4php/appenders/LoggerAppenderMongoDB.php",198,61,198,61] ,"d":"$ex->getPrevious()" ["log4php/appenders/LoggerAppenderMongoDB.php",199,71,199,71] ,"d":"$ex->getPrevious()" ["log4php/renderers/LoggerRendererException.php",34,59,34,59] ,"d":"$o->getPrevious()" ["log4php/renderers/LoggerRendererException.php",35,67,35,67] ,"d":"$o->getPrevious()" The Exception::getPrevious() method was added in PHP 5.3, you are presumably using 5.2. "UnknownFunction": ["log4php/Logger.php",25,0,25,50] ,"d":"spl_autoload_register(array('Logger', 'autoload'))" The method Logger::autoload() exists, I don't know why it raises an error. ["log4php/appenders/LoggerAppenderAdodb.php",122,15,122,44] ,"d":"adonewconnection($this->type)" This requires the ADODB extension. It can be found here: http://adodb.sourceforge.net/ ["log4php/appenders/LoggerAppenderSocket.php",188,2,188,17] ,"d":"parent::reset()" This is an error. The parent class has no reset method. I will remove this method call. "RequiredAfterOptionalParam": ["log4php/configurators/LoggerConfiguratorXml.php",138,30,138,68] ,"d":"LoggerHierarchy $repository" This is an error, the optional parameter should never come before the required ones. It will be fixed. "UseVoidReturn": ["log4php/LoggerReflectionUtils.php",52,54,52,54] ,"d":"$pSetter->setProperties($properties, $prefix)" I suppose the problem is that setProperties returns null, and that null is used (returned). Can you try to remove the return keyword from line 52, and see if this fixed the problem? Just do this: return $pSetter->setProperties($properties, $prefix); + $pSetter->setProperties($properties, $prefix); "UseUndeclaredConstant": ["log4php/appenders/LoggerAppenderAdodb.php",22,13,22,22] ,"d":"ADODB_DIR" I will add a check to see if ADODB_DIR is defined before using it. This should solve the issue. Note that the LoggerAppenderAdodb class is deprecated. I will discuss removing it from the code base, since it has been marked deprecated for a long while. This will solve all adodb related issues. Hope this helps. Best regards, Ivan
        Hide
        Ivan Habunek added a comment -

        We decide to remove the ADODB appender (LOG4PHP-149) which further solves some of your problems.

        Show
        Ivan Habunek added a comment - We decide to remove the ADODB appender ( LOG4PHP-149 ) which further solves some of your problems.
        Hide
        Karan Jain added a comment -

        Hi Ivan,

        Thanks a lot for taking time in going through the compilation errors and suggesting fixes for them. I have patched all the fixes as suggested by you.

        >> "UnknownFunction":
        ["log4php/Logger.php",25,0,25,50] ,"d":"spl_autoload_register(array('Logger', 'autoload'))"

        • The method Logger::autoload() exists, I don't know why it raises an error.

        [KARAN] - I think since this issue is Unknown function and is generated during compilation time, it might be because it could not find the spl_autoload_register function. I cross checked that PHP has SPL enabled and so it should occur. It could be a hiphop bug. I'll update once I investigate this further.

        >> "UseVoidReturn":
        ["log4php/LoggerReflectionUtils.php",52,54,52,54] ,"d":"$pSetter->setProperties($properties, $prefix)"

        • I suppose the problem is that setProperties returns null, and that null is used (returned). Can you try to remove the return keyword from line 52, and see if this fixed the problem? Just do this:
        • return $pSetter->setProperties($properties, $prefix);
          + $pSetter->setProperties($properties, $prefix);

        [KARAN] - I have done this fix and started the build using hiphop. I'll update you further if it worked or not.

        I had thought of similar fixes myself, but just wanted to consult an expert before making those changes so as to avoid any chances of unexpected behavior. Thanks a ton for all your help.

        Karan

        Show
        Karan Jain added a comment - Hi Ivan, Thanks a lot for taking time in going through the compilation errors and suggesting fixes for them. I have patched all the fixes as suggested by you. >> "UnknownFunction": ["log4php/Logger.php",25,0,25,50] ,"d":"spl_autoload_register(array('Logger', 'autoload'))" The method Logger::autoload() exists, I don't know why it raises an error. [KARAN] - I think since this issue is Unknown function and is generated during compilation time, it might be because it could not find the spl_autoload_register function. I cross checked that PHP has SPL enabled and so it should occur. It could be a hiphop bug. I'll update once I investigate this further. >> "UseVoidReturn": ["log4php/LoggerReflectionUtils.php",52,54,52,54] ,"d":"$pSetter->setProperties($properties, $prefix)" I suppose the problem is that setProperties returns null, and that null is used (returned). Can you try to remove the return keyword from line 52, and see if this fixed the problem? Just do this: return $pSetter->setProperties($properties, $prefix); + $pSetter->setProperties($properties, $prefix); [KARAN] - I have done this fix and started the build using hiphop. I'll update you further if it worked or not. I had thought of similar fixes myself, but just wanted to consult an expert before making those changes so as to avoid any chances of unexpected behavior. Thanks a ton for all your help. Karan
        Hide
        Karan Jain added a comment -

        Hi Ivan,

        I did a build after the above mentioned fixes. Everything worked fine except this -

        >> "UnknownFunction":
        ["log4php/Logger.php",25,0,25,50] ,"d":"spl_autoload_register(array('Logger', 'autoload'))"

        I cross checked and found that HipHop does not support this function as of now. So, I decided to see if HipHop allows __autoload function since it would be easy to replace the spl_autoload_register call here with the __autoload function provided it is making only single call for now. Though HipHop allowed compilation for __autoload but it didn't bring into effect the execution of __autoload i.e. code wriiten in __autoload didn't execute. So, I believe that HipHop does not support this function.

        In Logger.php, I believe the only job autoload function is doing is including the php file whenever it is being called via new Classname. Since I want the work to be done via HipHop and owing to above issues, will it be fine if I simply include all the required files for once at the top and remove the call to spl_autoload_register? I know this would affect the performance but this is the best way I could think of.

        Please suggest.

        Thanks,
        Karan

        Show
        Karan Jain added a comment - Hi Ivan, I did a build after the above mentioned fixes. Everything worked fine except this - >> "UnknownFunction": ["log4php/Logger.php",25,0,25,50] ,"d":"spl_autoload_register(array('Logger', 'autoload'))" I cross checked and found that HipHop does not support this function as of now. So, I decided to see if HipHop allows __autoload function since it would be easy to replace the spl_autoload_register call here with the __autoload function provided it is making only single call for now. Though HipHop allowed compilation for __autoload but it didn't bring into effect the execution of __autoload i.e. code wriiten in __autoload didn't execute. So, I believe that HipHop does not support this function. In Logger.php, I believe the only job autoload function is doing is including the php file whenever it is being called via new Classname. Since I want the work to be done via HipHop and owing to above issues, will it be fine if I simply include all the required files for once at the top and remove the call to spl_autoload_register? I know this would affect the performance but this is the best way I could think of. Please suggest. Thanks, Karan
        Hide
        Ivan Habunek added a comment -

        Including all files in Logger.php is the only solution I can think of as well. Besides, HipHop probably does some optimizations of it's own when compiling the code.

        Give it a shot and let us know how it works out.

        Regards,
        Ivan

        Show
        Ivan Habunek added a comment - Including all files in Logger.php is the only solution I can think of as well. Besides, HipHop probably does some optimizations of it's own when compiling the code. Give it a shot and let us know how it works out. Regards, Ivan
        Hide
        Karan Jain added a comment -

        It compiled successfully ! Thanks a lot for your help.

        //Closing this issue.

        Show
        Karan Jain added a comment - It compiled successfully ! Thanks a lot for your help. //Closing this issue.
        Hide
        Ivan Habunek added a comment -

        Cool. Hope it works out for you.

        Would you by any chance be interested in writing a short howto for our web, if you have the time? Just to explain the steps necessary to make log4php compile with HipHop.

        Show
        Ivan Habunek added a comment - Cool. Hope it works out for you. Would you by any chance be interested in writing a short howto for our web, if you have the time? Just to explain the steps necessary to make log4php compile with HipHop.

          People

          • Assignee:
            Ivan Habunek
            Reporter:
            Hitesh Kumar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development