cvs: php4 /pear/Log file.php
| From: | Jon Parise | Date: | Wed, 16 May 2001 17:32:01 +0000 |
| Subject: | cvs: php4 /pear/Log file.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-148@lists.php.net to get a copy of this message | ||
jon Wed May 16 10:32:01 2001 EDT
Modified files:
/php4/pear/Log file.php
Log:
Close the logfile after each write to prevent blocking due to concurrency.
Index: php4/pear/Log/file.php
diff -u php4/pear/Log/file.php:1.1 php4/pear/Log/file.php:1.2
--- php4/pear/Log/file.php:1.1 Wed Dec 6 17:06:58 2000
+++ php4/pear/Log/file.php Wed May 16 10:32:01 2001
@@ -6,7 +6,7 @@
* abstract class which writes message to a text file.
*
* @author Jon Parise <jon@csh.rit.edu>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
* @since Horde 1.3
*/
class Log_file extends Log {
@@ -82,8 +82,15 @@
$entry = sprintf("%s %s [%s] %s\n", strftime("%b %d %T"),
$this->ident, Log::priorityToString($priority), $message);
- if ($this->fp)
+ if ($this->fp) {
fwrite($this->fp, $entry);
+
+ /*
+ * The file must be closed immediately, or we will run into
+ * concurrency blocking issues.
+ */
+ $this->close();
+ }
$this->notifyAll(array('priority' => $priority, 'message' =>
$message));
}