Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Not a Problem
    • Affects Version/s: 2.2.1
    • Fix Version/s: None
    • Component/s: Code
    • Labels:
    • Environment:

      unix

      Description

      After some hours we get the following error from a php batch application

      PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 372 bytes)
      in /srv/www/cogesivtest.coopservice.it/lib/log4php/layouts/LoggerLayoutTTCC.php on line 188

      We have configured our logger implementing the LoggerConfigurator interface.

      $layout = new LoggerLayoutTTCC();
      $layout->setContextPrinting(true);
      $layout->setDateFormat('%Y-%m-%d %H:%M:%S');
      $layout->activateOptions();

      // Create an appender which logs to file
      $appFile = new LoggerAppenderRollingFile('default');
      $appFile->setFile(dirname(_FILE).'/../log/acquisizione'.$this->host.'.log');
      $appFile->setAppend(true);
      $appFile->setMaxBackupIndex(10);
      $appFile->setMaxFileSize("10MB");
      $appFile->setThreshold('debug');
      $appFile->setLayout($layout);
      $appFile->activateOptions();

      // Add both appenders to the root logger
      $root = $hierarchy->getRootLogger();
      $root->addAppender($appFile);

        Activity

        Hide
        Ivan Habunek added a comment -

        log4php should not leak memory, and in my experience it does not. I have several long-running applications at work and have not encountered this problem. Closing for now. If you manage to reproduce this issue with a repeatable test case, please reopen this issue.

        Show
        Ivan Habunek added a comment - log4php should not leak memory, and in my experience it does not. I have several long-running applications at work and have not encountered this problem. Closing for now. If you manage to reproduce this issue with a repeatable test case, please reopen this issue.
        Hide
        Sven Rautenberg added a comment -

        isa srl: Yes, PHP needs some memory to do stuff. The error occurs when PHP tries to allocate 372 Bytes, which adds more memory usage than allowed. I would expect it to be coincidence that this happens within Log4PHP code, unless you can prove that your application runs fine without Log4PHP.

        The error may be within your application. Long running PHP applications are a little bit uncommon, so developers usually skip the step of maintaining the memory footprint of their application by explicitly deleting objects. Of course this can also apply to Log4PHP, but essentially you are chasing a memory leak right now, which make it hard to assist you.

        Show
        Sven Rautenberg added a comment - isa srl: Yes, PHP needs some memory to do stuff. The error occurs when PHP tries to allocate 372 Bytes, which adds more memory usage than allowed. I would expect it to be coincidence that this happens within Log4PHP code, unless you can prove that your application runs fine without Log4PHP. The error may be within your application. Long running PHP applications are a little bit uncommon, so developers usually skip the step of maintaining the memory footprint of their application by explicitly deleting objects. Of course this can also apply to Log4PHP, but essentially you are chasing a memory leak right now, which make it hard to assist you.
        Hide
        isa srl added a comment -

        Thanks for your response Ivan.
        May be I've some memory problem in my application.
        To check this I need to know how log4php works: it use memory to write into a file log?
        I use the log into an application that is always running and after a day or two i got the error I reported.

        Thanks

        Show
        isa srl added a comment - Thanks for your response Ivan. May be I've some memory problem in my application. To check this I need to know how log4php works: it use memory to write into a file log? I use the log into an application that is always running and after a day or two i got the error I reported. Thanks
        Hide
        Ivan Habunek added a comment -

        log4php should not take up much memory. I have tried to recreate the problem using your configuration, but did not succeed. My memory consumption stays level.

        Is it possible that your application used up most of the allowed memory and then log4php drove it over the limit? In other words, I think you may have a memory leak in your application.

        In case I'm wrong, can you provide a script which would reproduce this error?

        Show
        Ivan Habunek added a comment - log4php should not take up much memory. I have tried to recreate the problem using your configuration, but did not succeed. My memory consumption stays level. Is it possible that your application used up most of the allowed memory and then log4php drove it over the limit? In other words, I think you may have a memory leak in your application. In case I'm wrong, can you provide a script which would reproduce this error?

          People

          • Assignee:
            Unassigned
            Reporter:
            isa srl
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development