You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by "Rasmus Lerdorf (JIRA)" <ji...@apache.org> on 2012/09/01 01:47:08 UTC
[jira] [Created] (LOG4PHP-185) Don't clear the entire stat cache on
an append
Rasmus Lerdorf created LOG4PHP-185:
--------------------------------------
Summary: Don't clear the entire stat cache on an append
Key: LOG4PHP-185
URL: https://issues.apache.org/jira/browse/LOG4PHP-185
Project: Log4php
Issue Type: Improvement
Reporter: Rasmus Lerdorf
Fix For: 2.2.1
As of PHP 5.3.0 you can selectively clear individual entries from the stat cache. So, I suggest this change:
Index: src/main/php/appenders/LoggerAppenderRollingFile.php
===================================================================
--- src/main/php/appenders/LoggerAppenderRollingFile.php (revision 1379664)
+++ src/main/php/appenders/LoggerAppenderRollingFile.php (working copy)
@@ -195,7 +195,7 @@
}
// Stats cache must be cleared, otherwise filesize() returns cached results
- clearstatcache();
+ clearstatcache(true, $this->file);
// Rollover if needed
if (filesize($this->file) > $this->maxFileSize) {
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (LOG4PHP-185) Don't clear the entire stat cache on
an append
Posted by "Ivan Habunek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4PHP-185?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ivan Habunek closed LOG4PHP-185.
--------------------------------
Resolution: Fixed
Fix Version/s: (was: 2.2.1)
2.3.0
Assignee: Ivan Habunek
Done and committed to trunk.
> Don't clear the entire stat cache on an append
> ----------------------------------------------
>
> Key: LOG4PHP-185
> URL: https://issues.apache.org/jira/browse/LOG4PHP-185
> Project: Log4php
> Issue Type: Improvement
> Reporter: Rasmus Lerdorf
> Assignee: Ivan Habunek
> Fix For: 2.3.0
>
>
> As of PHP 5.3.0 you can selectively clear individual entries from the stat cache. So, I suggest this change:
> Index: src/main/php/appenders/LoggerAppenderRollingFile.php
> ===================================================================
> --- src/main/php/appenders/LoggerAppenderRollingFile.php (revision 1379664)
> +++ src/main/php/appenders/LoggerAppenderRollingFile.php (working copy)
> @@ -195,7 +195,7 @@
> }
>
> // Stats cache must be cleared, otherwise filesize() returns cached results
> - clearstatcache();
> + clearstatcache(true, $this->file);
>
> // Rollover if needed
> if (filesize($this->file) > $this->maxFileSize) {
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (LOG4PHP-185) Don't clear the entire stat cache
on an append
Posted by "Ivan Habunek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4PHP-185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13446627#comment-13446627 ]
Ivan Habunek commented on LOG4PHP-185:
--------------------------------------
We aim to remain compatible with 5.2, until the next major version, so a conditional would be needed there.
Maybe something along these lines:
Index: LoggerAppenderRollingFile.php
===================================================================
--- LoggerAppenderRollingFile.php (revision 1374786)
+++ LoggerAppenderRollingFile.php (working copy)
@@ -79,6 +79,15 @@
*/
protected $compress = false;
+ private $clearConditional = false;
+
+ public function __construct($name = '') {
+ parent::__construct($name);
+ if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
+ $this->clearConditional = true;
+ }
+ }
+
/**
* Get the maximum size that the output file is allowed to reach
* before being rolled over to backup files.
@@ -195,7 +204,11 @@
}
// Stats cache must be cleared, otherwise filesize() returns cached results
- clearstatcache();
+ if ($this->clearConditional) {
+ clearstatcache(true, $this->file);
+ } else {
+ clearstatcache();
+ }
// Rollover if needed
if (filesize($this->file) > $this->maxFileSize) {
> Don't clear the entire stat cache on an append
> ----------------------------------------------
>
> Key: LOG4PHP-185
> URL: https://issues.apache.org/jira/browse/LOG4PHP-185
> Project: Log4php
> Issue Type: Improvement
> Reporter: Rasmus Lerdorf
> Fix For: 2.2.1
>
>
> As of PHP 5.3.0 you can selectively clear individual entries from the stat cache. So, I suggest this change:
> Index: src/main/php/appenders/LoggerAppenderRollingFile.php
> ===================================================================
> --- src/main/php/appenders/LoggerAppenderRollingFile.php (revision 1379664)
> +++ src/main/php/appenders/LoggerAppenderRollingFile.php (working copy)
> @@ -195,7 +195,7 @@
> }
>
> // Stats cache must be cleared, otherwise filesize() returns cached results
> - clearstatcache();
> + clearstatcache(true, $this->file);
>
> // Rollover if needed
> if (filesize($this->file) > $this->maxFileSize) {
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (LOG4PHP-185) Don't clear the entire stat cache
on an append
Posted by "Sven Rautenberg (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4PHP-185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13455163#comment-13455163 ]
Sven Rautenberg commented on LOG4PHP-185:
-----------------------------------------
This really cannot go into 2.2.1, as it is released already. Would like to see it in 2.3 without PHP 5.2 support, though. :)
> Don't clear the entire stat cache on an append
> ----------------------------------------------
>
> Key: LOG4PHP-185
> URL: https://issues.apache.org/jira/browse/LOG4PHP-185
> Project: Log4php
> Issue Type: Improvement
> Reporter: Rasmus Lerdorf
> Fix For: 2.2.1
>
>
> As of PHP 5.3.0 you can selectively clear individual entries from the stat cache. So, I suggest this change:
> Index: src/main/php/appenders/LoggerAppenderRollingFile.php
> ===================================================================
> --- src/main/php/appenders/LoggerAppenderRollingFile.php (revision 1379664)
> +++ src/main/php/appenders/LoggerAppenderRollingFile.php (working copy)
> @@ -195,7 +195,7 @@
> }
>
> // Stats cache must be cleared, otherwise filesize() returns cached results
> - clearstatcache();
> + clearstatcache(true, $this->file);
>
> // Rollover if needed
> if (filesize($this->file) > $this->maxFileSize) {
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Comment Edited] (LOG4PHP-185) Don't clear the entire stat
cache on an append
Posted by "Ivan Habunek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LOG4PHP-185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13446627#comment-13446627 ]
Ivan Habunek edited comment on LOG4PHP-185 at 9/8/12 9:03 PM:
--------------------------------------------------------------
We aim to remain compatible with 5.2, until the next major version, so a conditional would be needed there.
Maybe something along these lines:
{code}
Index: LoggerAppenderRollingFile.php
===================================================================
--- LoggerAppenderRollingFile.php (revision 1374786)
+++ LoggerAppenderRollingFile.php (working copy)
@@ -79,6 +79,15 @@
*/
protected $compress = false;
+ private $clearConditional = false;
+
+ public function __construct($name = '') {
+ parent::__construct($name);
+ if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
+ $this->clearConditional = true;
+ }
+ }
+
/**
* Get the maximum size that the output file is allowed to reach
* before being rolled over to backup files.
@@ -195,7 +204,11 @@
}
// Stats cache must be cleared, otherwise filesize() returns cached results
- clearstatcache();
+ if ($this->clearConditional) {
+ clearstatcache(true, $this->file);
+ } else {
+ clearstatcache();
+ }
// Rollover if needed
if (filesize($this->file) > $this->maxFileSize) {
{code}
was (Author: juice):
We aim to remain compatible with 5.2, until the next major version, so a conditional would be needed there.
Maybe something along these lines:
Index: LoggerAppenderRollingFile.php
===================================================================
--- LoggerAppenderRollingFile.php (revision 1374786)
+++ LoggerAppenderRollingFile.php (working copy)
@@ -79,6 +79,15 @@
*/
protected $compress = false;
+ private $clearConditional = false;
+
+ public function __construct($name = '') {
+ parent::__construct($name);
+ if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
+ $this->clearConditional = true;
+ }
+ }
+
/**
* Get the maximum size that the output file is allowed to reach
* before being rolled over to backup files.
@@ -195,7 +204,11 @@
}
// Stats cache must be cleared, otherwise filesize() returns cached results
- clearstatcache();
+ if ($this->clearConditional) {
+ clearstatcache(true, $this->file);
+ } else {
+ clearstatcache();
+ }
// Rollover if needed
if (filesize($this->file) > $this->maxFileSize) {
> Don't clear the entire stat cache on an append
> ----------------------------------------------
>
> Key: LOG4PHP-185
> URL: https://issues.apache.org/jira/browse/LOG4PHP-185
> Project: Log4php
> Issue Type: Improvement
> Reporter: Rasmus Lerdorf
> Fix For: 2.2.1
>
>
> As of PHP 5.3.0 you can selectively clear individual entries from the stat cache. So, I suggest this change:
> Index: src/main/php/appenders/LoggerAppenderRollingFile.php
> ===================================================================
> --- src/main/php/appenders/LoggerAppenderRollingFile.php (revision 1379664)
> +++ src/main/php/appenders/LoggerAppenderRollingFile.php (working copy)
> @@ -195,7 +195,7 @@
> }
>
> // Stats cache must be cleared, otherwise filesize() returns cached results
> - clearstatcache();
> + clearstatcache(true, $this->file);
>
> // Rollover if needed
> if (filesize($this->file) > $this->maxFileSize) {
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira