logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ihabu...@apache.org
Subject svn commit: r1187850 - in /logging/log4php/trunk/src: changes/changes.xml main/php/LoggerAppender.php
Date Sun, 23 Oct 2011 08:04:09 GMT
Author: ihabunek
Date: Sun Oct 23 08:04:09 2011
New Revision: 1187850

URL: http://svn.apache.org/viewvc?rev=1187850&view=rev
Log:
LOG4PHP-159: Moved call of LoggerAppender::close() method from destructor to register_shutdown_function().
This will insure appenders close gracefully even if a fatal error occurs.

Modified:
    logging/log4php/trunk/src/changes/changes.xml
    logging/log4php/trunk/src/main/php/LoggerAppender.php

Modified: logging/log4php/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/changes/changes.xml?rev=1187850&r1=1187849&r2=1187850&view=diff
==============================================================================
--- logging/log4php/trunk/src/changes/changes.xml (original)
+++ logging/log4php/trunk/src/changes/changes.xml Sun Oct 23 08:04:09 2011
@@ -21,6 +21,7 @@
 	</properties>
 	<body>
 	    <release version="2.2.0" date="SVN">
+	    	<action date="2011-10-23" type="fix" issue="LOG4PHP-159" dev="Ivan Habunek" due-to="Justin
Cherniak" due-to-email="justin dot cherniak at gmail dot com">Appenders do not close gracefully
if a fatal error occurs.</action>
 	    	<action date="2011-10-15" type="update" issue="LOG4PHP-152" dev="Ivan Habunek">A
rewrite of the configurator.</action>
 	    	<action date="2011-09-03" type="fix" issue="LOG4PHP-145" dev="Ivan Habunek">The
syslog appender does not correctly parse options</action>
 	    	<action date="2011-08-31" type="remove" issue="LOG4PHP-149" dev="Ivan Habunek">Remove
deprecated appender LoggerAppenderAdodb</action>

Modified: logging/log4php/trunk/src/main/php/LoggerAppender.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/LoggerAppender.php?rev=1187850&r1=1187849&r2=1187850&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerAppender.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerAppender.php Sun Oct 23 08:04:09 2011
@@ -75,13 +75,10 @@ abstract class LoggerAppender {
 	 */
 	public function __construct($name = '') {
 		$this->name = $name;
-	}
-	
-	/**
-	 * Default destructor; closes the appender.
-	 */
-	public function __destruct() {
-		$this->close();
+		
+		// Closes the appender on shutdown. Better than a destructor because
+		// it will be called even if a fatal error occurs (destructor won't).
+		register_shutdown_function(array($this, 'close'));
 	}
 
 	/**



Mime
View raw message