You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ih...@apache.org on 2012/08/19 17:53:21 UTC

svn commit: r1374777 - /logging/log4php/trunk/src/main/php/LoggerAppender.php

Author: ihabunek
Date: Sun Aug 19 15:53:20 2012
New Revision: 1374777

URL: http://svn.apache.org/viewvc?rev=1374777&view=rev
Log:
Removed usage of register_shutdown_function which was used instead of  a distructor in LoggerAppender. This function yielded some unexpected and undesirable behaviour.

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

Modified: logging/log4php/trunk/src/main/php/LoggerAppender.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/LoggerAppender.php?rev=1374777&r1=1374776&r2=1374777&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerAppender.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerAppender.php Sun Aug 19 15:53:20 2012
@@ -75,16 +75,16 @@ abstract class LoggerAppender extends Lo
 	 */
 	public function __construct($name = '') {
 		$this->name = $name;
-		
-		// 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'));
-		
+
 		if ($this->requiresLayout) {
 			$this->layout = $this->getDefaultLayout();
 		}
 	}
 	
+	public function __destruct() {
+		$this->close();
+	}
+	
 	/**
 	 * Returns the default layout for this appender. Can be overriden by 
 	 * derived appenders.