Re: ftell Issue or Feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8 June 2011 10:19, Frank Arensmeier <farensmeier@xxxxxxxxx> wrote:
> 8 jun 2011 kl. 09.09 skrev Christian Grobmeier:
>
>> The object itself is always the same, for all threads. Every thread
>> gets this "Appender" from a kind of a pool.
>>
>> My guess is, every thread gets some kind of a copy of this object,
>> working at it. Once it reaches the method, its members states are not
>> reflected into the other stack call.
>
> I never worked with "log4php", so I am really not sure how "getMaxFileSize" calculates the log file size. In general, results for functions like PHP's "filesize" are cached. See e.g. http://php.net/manual/en/function.filesize.php
>
> Right after the flock call, try to clear the cache with clearstatcache().
>
> Maybe that helps.
> /frank


if((ftell($this->fp) > ($maxFileSize = $this->getMaxFileSize())) &&
flock($this->fp, LOCK_EX)) {
	clearstatcache();
	if(ftell($this->fp) > $maxFileSize) {
               $this->rollOver();
       }
}

would be my take.


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux