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 ih...@apache.org on 2011/01/15 11:56:24 UTC

svn commit: r1059292 [1/2] - in /logging/log4php/trunk/src/main/php: ./ appenders/ configurators/ filters/ helpers/ layouts/ renderers/

Author: ihabunek
Date: Sat Jan 15 10:56:23 2011
New Revision: 1059292

URL: http://svn.apache.org/viewvc?rev=1059292&view=rev
Log:
Cleaned up code formatting throughout the codebase. Replaced space indentation with tabs. No code or documentation changes.

Modified:
    logging/log4php/trunk/src/main/php/LoggerAppender.php
    logging/log4php/trunk/src/main/php/LoggerFilter.php
    logging/log4php/trunk/src/main/php/LoggerHierarchy.php
    logging/log4php/trunk/src/main/php/LoggerLevel.php
    logging/log4php/trunk/src/main/php/LoggerLoggingEvent.php
    logging/log4php/trunk/src/main/php/LoggerReflectionUtils.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderAdodb.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php
    logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php
    logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php
    logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php
    logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php
    logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php
    logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php
    logging/log4php/trunk/src/main/php/helpers/LoggerBasicPatternConverter.php
    logging/log4php/trunk/src/main/php/helpers/LoggerFormattingInfo.php
    logging/log4php/trunk/src/main/php/helpers/LoggerLocationPatternConverter.php
    logging/log4php/trunk/src/main/php/helpers/LoggerNamedPatternConverter.php
    logging/log4php/trunk/src/main/php/helpers/LoggerOptionConverter.php
    logging/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php
    logging/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php
    logging/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php
    logging/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php
    logging/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php
    logging/log4php/trunk/src/main/php/renderers/LoggerRendererException.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=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerAppender.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerAppender.php Sat Jan 15 10:56:23 2011
@@ -7,7 +7,7 @@
  * (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  *
- *	   http://www.apache.org/licenses/LICENSE-2.0
+ *	7 http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -42,12 +42,12 @@ abstract class LoggerAppender {
 	 * @var LoggerLayout
 	 */
 	protected $layout = null; 
-		   
+	
 	/**
 	 * @var string Appender name
 	 */
 	protected $name;
-		   
+	
 	/**
 	 * @var LoggerLevel There is no level threshold filtering by default.
 	 */
@@ -131,7 +131,7 @@ abstract class LoggerAppender {
 				case LoggerFilter::NEUTRAL: $f = $f->getNext();
 			}
 		}
-		$this->append($event);	  
+		$this->append($event);
 	}	 
 
 	/**
@@ -214,9 +214,9 @@ abstract class LoggerAppender {
 	 */
 	public function setThreshold($threshold) {
 		if(is_string($threshold)) {
-		   $this->threshold = LoggerOptionConverter::toLevel($threshold, null);
+			$this->threshold = LoggerOptionConverter::toLevel($threshold, null);
 		} else if($threshold instanceof LoggerLevel) {
-		   $this->threshold = $threshold;
+			$this->threshold = $threshold;
 		}
 	}
 	
@@ -239,7 +239,7 @@ abstract class LoggerAppender {
 	 * Derived appenders should override this method if option structure
 	 * requires it.
 	 */
-	abstract public function activateOptions();	   
+	abstract public function activateOptions();
 	
 	/**
 	 * Subclasses of {@link LoggerAppender} should implement 

Modified: logging/log4php/trunk/src/main/php/LoggerFilter.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/LoggerFilter.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerFilter.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerFilter.php Sat Jan 15 10:56:23 2011
@@ -69,7 +69,7 @@ abstract class LoggerFilter {
 	
 	/**
 	 * The log event must be dropped immediately without consulting
-	 * with the remaining filters, if any, in the chain.  
+	 * with the remaining filters, if any, in the chain.
 	 */
 	const DENY = -1;
 
@@ -85,8 +85,8 @@ abstract class LoggerFilter {
 	public function activateOptions() {
 	}
 
-	/**	  
-	 * Decide what to do.  
+	/**
+	 * Decide what to do.
 	 * <p>If the decision is {@link LoggerFilter::DENY}, then the event will be
 	 * dropped. If the decision is {@link LoggerFilter::NEUTRAL}, then the next
 	 * filter, if any, will be invoked. If the decision is {@link LoggerFilter::ACCEPT} then
@@ -109,9 +109,9 @@ abstract class LoggerFilter {
 	 */
 	public function addNext($filter) {
 		if($this->next !== null) {
-		    $this->next->addNext($filter);
+			$this->next->addNext($filter);
 		} else {
-		    $this->next = $filter;
+			$this->next = $filter;
 		}
 	}
 	

Modified: logging/log4php/trunk/src/main/php/LoggerHierarchy.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/LoggerHierarchy.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerHierarchy.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerHierarchy.php Sat Jan 15 10:56:23 2011
@@ -85,7 +85,7 @@ class LoggerHierarchy {
 	public function clear() {
 		$this->ht = array();
 	}
-	  
+	
 	/**
 	 * Check if the named logger exists in the hierarchy.
 	 * @param string $name
@@ -107,7 +107,7 @@ class LoggerHierarchy {
 	 * Return a new logger instance named as the first parameter using the default factory.
 	 * 
 	 * @param string $name logger name
-	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null	  
+	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
 	 * @return Logger
 	 */
 	public function getLogger($name) {
@@ -236,7 +236,7 @@ class LoggerHierarchy {
 	public function shutdown() {
 		$this->root->removeAllAppenders();
 		$cats = $this->getCurrentLoggers();
-		$enumCats = count($cats);		  
+		$enumCats = count($cats);
 		if($enumCats > 0) {
 			for($i = 0; $i < $enumCats; $i++) {
 				$cats[$i]->removeAllAppenders();

Modified: logging/log4php/trunk/src/main/php/LoggerLevel.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/LoggerLevel.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerLevel.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerLevel.php Sat Jan 15 10:56:23 2011
@@ -47,17 +47,17 @@ class LoggerLevel {
 	 * @var integer
 	 */
 	private $level;
-  
-  	/**
-   	 * Contains a list of instantiated levels 
-   	 */
-  	private static $levelMap;
-  	
+	
+	/**
+	 * Contains a list of instantiated levels 
+	 */
+	private static $levelMap;
+
 	/**
 	 * @var string
 	 */
 	private $levelStr;
-  
+
 	/**
 	 * @var integer
 	 */
@@ -85,7 +85,7 @@ class LoggerLevel {
 	public function equals($o) {
 		if($o instanceof LoggerLevel) {
 			if($this->level == $o->level) {
-			    return true;
+				return true;
 			}
 		} else {
 			return false;
@@ -200,7 +200,7 @@ class LoggerLevel {
 	/**
 	 * Returns <i>true</i> if this level has a higher or equal
 	 * level than the level passed as argument, <i>false</i>
-	 * otherwise.  
+	 * otherwise.
 	 * 
 	 * <p>You should think twice before overriding the default
 	 * implementation of <i>isGreaterOrEqual</i> method.

Modified: logging/log4php/trunk/src/main/php/LoggerLoggingEvent.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/LoggerLoggingEvent.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerLoggingEvent.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerLoggingEvent.php Sat Jan 15 10:56:23 2011
@@ -109,10 +109,10 @@ class LoggerLoggingEvent {
 	* @var LoggerLocationInfo Location information for the caller. 
 	*/
 	private $locationInfo = null;
-                   
-    /**
-    * @var LoggerThrowableInformation log4php internal representation of throwable
-    */
+	
+	/**
+	 * @var LoggerThrowableInformation log4php internal representation of throwable
+	 */
 	private $throwableInfo = null;
 	
 	/**
@@ -126,7 +126,7 @@ class LoggerLoggingEvent {
 	* @param LoggerLevel $priority The level of this event.
 	* @param mixed $message The message of this event.
 	* @param integer $timeStamp the timestamp of this logging event.
-    * @param Exception $throwable The throwable associated with logging event
+	* @param Exception $throwable The throwable associated with logging event
 	*/
 	public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null, Exception $throwable = null) {
 		$this->fqcn = $fqcn;
@@ -282,10 +282,10 @@ class LoggerLoggingEvent {
 			if(is_string($this->message)) {
 					$this->renderedMessage = $this->message;
 			} else {
-			    // $this->logger might be null or an instance of Logger or RootLogger
-			    // But in contrast to log4j, in log4php there is only have one LoggerHierarchy so there is
-			    // no need figure out which one is $this->logger part of.
-			    // TODO: Logger::getHierarchy() is marked @deprecated!
+				// $this->logger might be null or an instance of Logger or RootLogger
+				// But in contrast to log4j, in log4php there is only have one LoggerHierarchy so there is
+				// no need figure out which one is $this->logger part of.
+				// TODO: Logger::getHierarchy() is marked @deprecated!
 				$repository = Logger::getHierarchy();
 				$rendererMap = $repository->getRendererMap();
 				$this->renderedMessage= $rendererMap->findAndRender($this->message);
@@ -325,10 +325,10 @@ class LoggerLoggingEvent {
 	 * @return the time after event starttime when this event has occured
 	 */
 	public function getTime() {
-        $eventTime = (float)$this->getTimeStamp();
-        $eventStartTime = (float)LoggerLoggingEvent::getStartTime();
-        return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
-    }
+		$eventTime = (float)$this->getTimeStamp();
+		$eventStartTime = (float)LoggerLoggingEvent::getStartTime();
+		return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
+	}
 	
 	/**
 	 * @return mixed

Modified: logging/log4php/trunk/src/main/php/LoggerReflectionUtils.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/LoggerReflectionUtils.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/LoggerReflectionUtils.php (original)
+++ logging/log4php/trunk/src/main/php/LoggerReflectionUtils.php Sat Jan 15 10:56:23 2011
@@ -18,14 +18,14 @@
  * @package log4php
  */
  
- /**
-  * Provides methods for reflective use on php objects
-  * @package log4php
-  */
+/**
+ * Provides methods for reflective use on php objects
+ * @package log4php
+ */
 class LoggerReflectionUtils {
 		/** the target object */
 	private $obj;
-  
+	
 	/**
 	 * Create a new LoggerReflectionUtils for the specified Object. 
 	 * This is done in prepartion for invoking {@link setProperty()} 
@@ -35,7 +35,7 @@ class LoggerReflectionUtils {
 	public function __construct($obj) {
 		$this->obj = $obj;
 	}
-  
+	
 	/**
 	 * Set the properties of an object passed as a parameter in one
 	 * go. The <code>properties</code> are parsed relative to a
@@ -51,8 +51,8 @@ class LoggerReflectionUtils {
 		$pSetter = new LoggerReflectionUtils($obj);
 		return $pSetter->setProperties($properties, $prefix);
 	}
-  
-
+	
+	
 	/**
 	 * Set the properites for the object that match the
 	 * <code>prefix</code> passed as parameter.
@@ -98,8 +98,8 @@ class LoggerReflectionUtils {
 	 * to an int using new Integer(value). If the setter expects a boolean,
 	 * the conversion is by new Boolean(value).
 	 *
-	 * @param string $name	  name of the property
-	 * @param string $value	  String value of the property
+	 * @param string $name	name of the property
+	 * @param string $value	String value of the property
 	 */
 	public function setProperty($name, $value) {
 		if($value === null) {
@@ -114,7 +114,7 @@ class LoggerReflectionUtils {
 			return call_user_func(array($this->obj, $method), $value);
 		} 
 	}
-  
+	
 	public function activate() {
 		if(method_exists($this->obj, 'activateoptions')) {
 			return call_user_func(array($this->obj, 'activateoptions'));
@@ -136,20 +136,20 @@ class LoggerReflectionUtils {
 	}
 	
 	/**
-     * @param object $object
-     * @param string $name
-     * @param mixed $value
-     */
-    public static function setter($object, $name, $value) {
-        if (empty($name)) {
-            return false;
-        }
-        $methodName = 'set'.ucfirst($name);
-        if (method_exists($object, $methodName)) {
-            return call_user_func(array($object, $methodName), $value);
-        } else {
-            return false;
-        }
-    }
+	 * @param object $object
+	 * @param string $name
+	 * @param mixed $value
+	 */
+	public static function setter($object, $name, $value) {
+		if (empty($name)) {
+			return false;
+		}
+		$methodName = 'set'.ucfirst($name);
+		if (method_exists($object, $methodName)) {
+			return call_user_func(array($object, $methodName), $value);
+		} else {
+			return false;
+		}
+	}
 	
 }

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderAdodb.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderAdodb.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderAdodb.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderAdodb.php Sat Jan 15 10:56:23 2011
@@ -36,228 +36,228 @@ require_once(ADODB_DIR . '/adodb.inc.php
  */
 class LoggerAppenderAdodb extends LoggerAppender {
 
-    /**
-     * Create the log table if it does not exists (optional).
-     * @var boolean
-     */
-    var $createTable = true;
-    
-    /**
-     * The type of database to connect to
-     * @var string
-     */
-    var $type;
-    
-    /**
-     * Database user name
-     * @var string
-     */
-    var $user;
-    
-    /**
-     * Database password
-     * @var string
-     */
-    var $password;
-    
-    /**
-     * Database host to connect to
-     * @var string
-     */
-    var $host;
-    
-    /**
-     * Name of the database to connect to
-     * @var string
-     */
-    var $database;
-    
-    /**
-     * A {@link LoggerPatternLayout} string used to format a valid insert query (mandatory).
-     * @var string
-     */
-    var $sql;
-    
-    /**
-     * Table name to write events. Used only if {@link $createTable} is true.
-     * @var string
-     */    
-    var $table;
-    
-    /**
-     * @var object Adodb instance
-     * @access private
-     */
-    var $db = null;
-    
-    /**
-     * @var boolean used to check if all conditions to append are true
-     * @access private
-     */
-    var $canAppend = true;
-    
-    /**    
-     * @access private
-     */
-    var $requiresLayout = false;
-    
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    function __construct($name)
-    {
-        parent::__construct($name);
-    }
+	/**
+	 * Create the log table if it does not exists (optional).
+	 * @var boolean
+	 */
+	var $createTable = true;
+	
+	/**
+	 * The type of database to connect to
+	 * @var string
+	 */
+	var $type;
+	
+	/**
+	 * Database user name
+	 * @var string
+	 */
+	var $user;
+	
+	/**
+	 * Database password
+	 * @var string
+	 */
+	var $password;
+	
+	/**
+	 * Database host to connect to
+	 * @var string
+	 */
+	var $host;
+	
+	/**
+	 * Name of the database to connect to
+	 * @var string
+	 */
+	var $database;
+	
+	/**
+	 * A {@link LoggerPatternLayout} string used to format a valid insert query (mandatory).
+	 * @var string
+	 */
+	var $sql;
+	
+	/**
+	 * Table name to write events. Used only if {@link $createTable} is true.
+	 * @var string
+	 */	
+	var $table;
+	
+	/**
+	 * @var object Adodb instance
+	 * @access private
+	 */
+	var $db = null;
+	
+	/**
+	 * @var boolean used to check if all conditions to append are true
+	 * @access private
+	 */
+	var $canAppend = true;
+	
+	/**	
+	 * @access private
+	 */
+	var $requiresLayout = false;
+	
+	/**
+	 * Constructor.
+	 *
+	 * @param string $name appender name
+	 */
+	function __construct($name)
+	{
+		parent::__construct($name);
+	}
 
-    /**
-     * Setup db connection.
-     * Based on defined options, this method connects to db defined in {@link $dsn}
-     * and creates a {@link $table} table if {@link $createTable} is true.
-     * @return boolean true if all ok.
-     */
-    function activateOptions()
-    {        
-        $this->db = &ADONewConnection($this->type);
-        if (! $this->db->PConnect($this->host, $this->user, $this->password, $this->database)) {
-          $this->db = null;
-          $this->closed = true;
-          $this->canAppend = false;
-          return;
-        }
-        
-        $this->layout = LoggerReflectionUtils::createObject('LoggerLayoutPattern');
-        $this->layout->setConversionPattern($this->getSql());
-    
-        // test if log table exists
-        $sql = 'select * from ' . $this->table . ' where 1 = 0';
-        $dbrs = $this->db->Execute($sql);
-        if ($dbrs == false and $this->getCreateTable()) {
-            $query = "CREATE TABLE {$this->table} (timestamp varchar(32),logger varchar(32),level varchar(32),message varchar(64),thread varchar(32),file varchar(64),line varchar(4) );";
+	/**
+	 * Setup db connection.
+	 * Based on defined options, this method connects to db defined in {@link $dsn}
+	 * and creates a {@link $table} table if {@link $createTable} is true.
+	 * @return boolean true if all ok.
+	 */
+	function activateOptions()
+	{		
+		$this->db = &ADONewConnection($this->type);
+		if (! $this->db->PConnect($this->host, $this->user, $this->password, $this->database)) {
+			$this->db = null;
+			$this->closed = true;
+			$this->canAppend = false;
+			return;
+		}
+		
+		$this->layout = LoggerReflectionUtils::createObject('LoggerLayoutPattern');
+		$this->layout->setConversionPattern($this->getSql());
+	
+		// test if log table exists
+		$sql = 'select * from ' . $this->table . ' where 1 = 0';
+		$dbrs = $this->db->Execute($sql);
+		if ($dbrs == false and $this->getCreateTable()) {
+			$query = "CREATE TABLE {$this->table} (timestamp varchar(32),logger varchar(32),level varchar(32),message varchar(64),thread varchar(32),file varchar(64),line varchar(4) );";
 
-                     
-            $result = $this->db->Execute($query);
-            if (! $result) {
-                $this->canAppend = false;
-                return;
-            }
-        }
-        $this->canAppend = true;
-    }
-    
-    function append(LoggerLoggingEvent $event) {
-        if ($this->canAppend) {
-            $query = $this->layout->format($event);
-            $this->db->Execute($query);
-        }
-    }
-    
-    function close()
-    {
-        if ($this->db !== null)
-            $this->db->Close();
-        $this->closed = true;
-    }
-    
-    /**
-     * @return boolean
-     */
-    function getCreateTable()
-    {
-        return $this->createTable;
-    }
-    
-    /**
-     * @return string the sql pattern string
-     */
-    function getSql()
-    {
-        return $this->sql;
-    }
-    
-    /**
-     * @return string the table name to create
-     */
-    function getTable()
-    {
-        return $this->table;
-    }
-    
-    /**
-     * @return string the database to connect to
-     */
-    function getDatabase() {
-        return $this->database;
-    }
-    
-    /**
-     * @return string the database to connect to
-     */
-    function getHost() {
-        return $this->host;
-    }
-    
-    /**
-     * @return string the user to connect with
-     */
-    function getUser() {
-        return $this->user;
-    }
-    
-    /**
-     * @return string the password to connect with
-     */
-    function getPassword() {
-        return $this->password;
-    }
-    
-    /**
-     * @return string the type of database to connect to
-     */
-    function getType() {
-        return $this->type;
-    }
-    
-    function setCreateTable($flag)
-    {
-        $this->createTable = LoggerOptionConverter::toBoolean($flag, true);
-    }
-    
-    function setType($newType)
-    {
-        $this->type = $newType;
-    }
-    
-    function setDatabase($newDatabase)
-    {
-        $this->database = $newDatabase;
-    }
-    
-    function setHost($newHost)
-    {
-        $this->host = $newHost;
-    }
-    
-    function setUser($newUser)
-    {
-        $this->user = $newUser;
-    }
-    
-    function setPassword($newPassword)
-    {
-        $this->password = $newPassword;
-    }
-    
-    function setSql($sql)
-    {
-        $this->sql = $sql;    
-    }
-    
-    function setTable($table)
-    {
-        $this->table = $table;
-    }
-    
+					 
+			$result = $this->db->Execute($query);
+			if (! $result) {
+				$this->canAppend = false;
+				return;
+			}
+		}
+		$this->canAppend = true;
+	}
+	
+	function append(LoggerLoggingEvent $event) {
+		if ($this->canAppend) {
+			$query = $this->layout->format($event);
+			$this->db->Execute($query);
+		}
+	}
+	
+	function close()
+	{
+		if ($this->db !== null)
+			$this->db->Close();
+		$this->closed = true;
+	}
+	
+	/**
+	 * @return boolean
+	 */
+	function getCreateTable()
+	{
+		return $this->createTable;
+	}
+	
+	/**
+	 * @return string the sql pattern string
+	 */
+	function getSql()
+	{
+		return $this->sql;
+	}
+	
+	/**
+	 * @return string the table name to create
+	 */
+	function getTable()
+	{
+		return $this->table;
+	}
+	
+	/**
+	 * @return string the database to connect to
+	 */
+	function getDatabase() {
+		return $this->database;
+	}
+	
+	/**
+	 * @return string the database to connect to
+	 */
+	function getHost() {
+		return $this->host;
+	}
+	
+	/**
+	 * @return string the user to connect with
+	 */
+	function getUser() {
+		return $this->user;
+	}
+	
+	/**
+	 * @return string the password to connect with
+	 */
+	function getPassword() {
+		return $this->password;
+	}
+	
+	/**
+	 * @return string the type of database to connect to
+	 */
+	function getType() {
+		return $this->type;
+	}
+	
+	function setCreateTable($flag)
+	{
+		$this->createTable = LoggerOptionConverter::toBoolean($flag, true);
+	}
+	
+	function setType($newType)
+	{
+		$this->type = $newType;
+	}
+	
+	function setDatabase($newDatabase)
+	{
+		$this->database = $newDatabase;
+	}
+	
+	function setHost($newHost)
+	{
+		$this->host = $newHost;
+	}
+	
+	function setUser($newUser)
+	{
+		$this->user = $newUser;
+	}
+	
+	function setPassword($newPassword)
+	{
+		$this->password = $newPassword;
+	}
+	
+	function setSql($sql)
+	{
+		$this->sql = $sql;	
+	}
+	
+	function setTable($table)
+	{
+		$this->table = $table;
+	}
+	
 }
 

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderConsole.php Sat Jan 15 10:56:23 2011
@@ -49,26 +49,26 @@ class LoggerAppenderConsole extends Logg
 	/**
 	 * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords <b>STDOUT</b> and <b>STDERR</b> (case insensitive). 
 	 * Default is STDOUT
-	 * @var string	  
+	 * @var string
 	 */
 	private $target = self::STDOUT;
 	
 	/**
 	 * @var boolean
-	 * @access private	   
+	 * @access private
 	 */
 	protected $requiresLayout = true;
 
 	/**
 	 * @var mixed the resource used to open stdout/stderr
-	 * @access private	   
+	 * @access private
 	 */
 	protected $fp = null;
 
 	public function __destruct() {
-       $this->close();
-   	}
-   	
+		$this->close();
+	}
+	
 	/**
 	 * Set console target.
 	 * @param mixed $value a constant or a string
@@ -79,7 +79,7 @@ class LoggerAppenderConsole extends Logg
 			$this->target = self::STDOUT;
 		} elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
 			$this->target = self::STDERR;
-		} 
+		}
 	}
 
 	public function activateOptions() {
@@ -87,7 +87,7 @@ class LoggerAppenderConsole extends Logg
 		if(is_resource($this->fp) && $this->layout !== null) {
 			fwrite($this->fp, $this->layout->getHeader());
 		}
-		$this->closed = (bool)is_resource($this->fp) === false; 
+		$this->closed = (bool)is_resource($this->fp) === false;
 	}
 	
 	/**
@@ -100,13 +100,13 @@ class LoggerAppenderConsole extends Logg
 				fclose($this->fp);
 			}
 			$this->closed = true;
-		}			 
+		}
 	}
 
 	public function append(LoggerLoggingEvent $event) {
 		if (is_resource($this->fp) && $this->layout !== null) {
 			fwrite($this->fp, $this->layout->format($event));
-		} 
+		}
 	}
 }
 

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderDailyFile.php Sat Jan 15 10:56:23 2011
@@ -54,9 +54,9 @@ class LoggerAppenderDailyFile extends Lo
 	public $datePattern = "Ymd";
 	
 	public function __destruct() {
-       parent::__destruct();
-   	}
-   	
+		parent::__destruct();
+	}
+	
 	/**
 	* Sets date format for the file name.
 	* @param string $format a regular date() string format

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderFile.php Sat Jan 15 10:56:23 2011
@@ -46,10 +46,12 @@ class LoggerAppenderFile extends LoggerA
 	 * @var boolean if {@link $file} exists, appends events.
 	 */
 	private $append = true;
+	
 	/**
 	 * @var string the file name used to append events
 	 */
 	protected $fileName;
+	
 	/**
 	 * @var mixed file resource
 	 */
@@ -61,9 +63,9 @@ class LoggerAppenderFile extends LoggerA
 	}
 
 	public function __destruct() {
-       $this->close();
-   	}
-   	
+		$this->close();
+	}
+	
 	public function activateOptions() {
 		$fileName = $this->getFile();
 
@@ -152,7 +154,7 @@ class LoggerAppenderFile extends LoggerA
 	}
 
 	public function setAppend($flag) {
-		$this->append = LoggerOptionConverter::toBoolean($flag, true);		  
+		$this->append = LoggerOptionConverter::toBoolean($flag, true);
 	}
 
 	public function setFileName($fileName) {

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMail.php Sat Jan 15 10:56:23 2011
@@ -80,8 +80,8 @@ class LoggerAppenderMail extends LoggerA
 	}
 
 	public function __destruct() {
-       $this->close();
-   	}
+		$this->close();
+	}
 
 	public function activateOptions() {
 		$this->closed = false;

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderMailEvent.php Sat Jan 15 10:56:23 2011
@@ -96,23 +96,23 @@ class LoggerAppenderMailEvent extends Lo
 	}
 
 	public function __destruct() {
-       $this->close();
-   	}
-   	
+		$this->close();
+	}
+	
 	public function activateOptions() {
-	    if (empty($this->layout)) {
-	        throw new LoggerException("LoggerAppenderMailEvent requires layout!");
-	    }
-	    if (empty($this->to)) {
-            throw new LoggerException("LoggerAppenderMailEvent was initialized with empty 'from' ($this->from) or 'to' ($this->to) Adress!");
-        }
-        
-        $sendmail_from = ini_get('sendmail_from');
-        if (empty($this->from) and empty($sendmail_from)) {
-            throw new LoggerException("LoggerAppenderMailEvent requires 'from' or on win32 at least the ini variable sendmail_from!");
-        }
-        
-        $this->closed = false;
+		if (empty($this->layout)) {
+			throw new LoggerException("LoggerAppenderMailEvent requires layout!");
+		}
+		if (empty($this->to)) {
+			throw new LoggerException("LoggerAppenderMailEvent was initialized with empty 'from' ($this->from) or 'to' ($this->to) Adress!");
+		}
+		
+		$sendmail_from = ini_get('sendmail_from');
+		if (empty($this->from) and empty($sendmail_from)) {
+			throw new LoggerException("LoggerAppenderMailEvent requires 'from' or on win32 at least the ini variable sendmail_from!");
+		}
+		
+		$this->closed = false;
 	}
 	
 	public function close() {
@@ -162,14 +162,13 @@ class LoggerAppenderMailEvent extends Lo
 		
 		if(!$this->dry) {
 			$result = mail($this->to, $this->subject, 
-				$this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), 
-				$addHeader);			
-		    if ($result === false) {
-		        // The error message is only printed to stderr as warning. Any idea how to get it?
-		        throw new LoggerException("Error sending mail to '".$this->to."'!");
-		    }
+				$this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), $addHeader);			
+			if ($result === false) {
+				// The error message is only printed to stderr as warning. Any idea how to get it?
+				throw new LoggerException("Error sending mail to '".$this->to."'!");
+			}
 		} else {
-		    echo "DRY MODE OF MAIL APP.: Send mail to: ".$this->to." with additional headers '".trim($addHeader)."' and content: ".$this->layout->format($event);
+			echo "DRY MODE OF MAIL APP.: Send mail to: ".$this->to." with additional headers '".trim($addHeader)."' and content: ".$this->layout->format($event);
 		}
 			
 		ini_set('SMTP', $prevSmtpHost);

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderNull.php Sat Jan 15 10:56:23 2011
@@ -38,9 +38,9 @@ class LoggerAppenderNull extends LoggerA
 	protected $requiresLayout = false;
 	
 	public function __destruct() {
-       $this->close();
-   	}
-   	
+		$this->close();
+	}
+	
 	public function activateOptions() {
 		$this->closed = false;
 	}

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPDO.php Sat Jan 15 10:56:23 2011
@@ -46,252 +46,274 @@
  */
 class LoggerAppenderPDO extends LoggerAppender {
 
-    /** Create the log table if it does not exists (optional).
-     * @var string */
+	/** 
+	 * Create the log table if it does not exists (optional).
+	 * @var string 
+	 */
 	private $createTable = true;
-    
-    /** Database user name.
-     * @var string */
-    private $user = '';
-    
-    /** Database password
-     * @var string */
-    private $password = '';
-    
-    /** DSN string for enabling a connection.
-     * @var string */
-    private $dsn;
-    
-    /** A {@link LoggerPatternLayout} string used to format a valid insert query.
-     * @deprecated Use {@link $insertSql} and {@link $insertPattern} which properly handle quotes in the messages!
-     * @var string */
-    private $sql;
-    
-    /** Can be set to a complete insert statement with ? that are replaced using {@link insertPattern}.
-     * @var string */
-    private $insertSql = "INSERT INTO __TABLE__ (timestamp, logger, level, message, thread, file, line) VALUES (?,?,?,?,?,?,?)";
-
-    /** A comma separated list of {@link LoggerPatternLayout} format strings that replace the "?" in {@link $sql}.
-     * @var string */
-    private $insertPattern = "%d,%c,%p,%m,%t,%F,%L";
-
-    /** Table name to write events. Used only for CREATE TABLE if {@link $createTable} is true.
-     * @var string */
-    private $table = 'log4php_log';
-    
-    /** The PDO instance.
-     * @var PDO */
-    private $db = null;
-    
-    /** Prepared statement for the INSERT INTO query.
-     * @var PDOStatement */
-    private $preparedInsert;
-
-    /** Set in activateOptions() and later used in append() to check if all conditions to append are true.
-     * @var boolean */
-    private $canAppend = true;
-    
-    /**
-     * Constructor.
-     * This apender doesn't require a layout.
-     * @param string $name appender name
-     */
-    public function __construct($name = '') {
-        parent::__construct($name);
-        $this->requiresLayout = false;
-    }
-    
+	
+	/** 
+	 * Database user name.
+	 * @var string 
+	 */
+	private $user = '';
+	
+	/** 
+	 * Database password
+	 * @var string 
+	 */
+	private $password = '';
+	
+	/** 
+	 * DSN string for enabling a connection.
+	 * @var string 
+	 */
+	private $dsn;
+	
+	/** 
+	 * A {@link LoggerPatternLayout} string used to format a valid insert query.
+	 * @deprecated Use {@link $insertSql} and {@link $insertPattern} which properly handle quotes in the messages!
+	 * @var string 
+	 */
+	private $sql;
+	
+	/** 
+	 * Can be set to a complete insert statement with ? that are replaced using {@link insertPattern}.
+	 * @var string 
+	 */
+	private $insertSql = "INSERT INTO __TABLE__ (timestamp, logger, level, message, thread, file, line) VALUES (?,?,?,?,?,?,?)";
+
+	/** 
+	 * A comma separated list of {@link LoggerPatternLayout} format strings that replace the "?" in {@link $sql}.
+	 * @var string 
+	 */
+	private $insertPattern = "%d,%c,%p,%m,%t,%F,%L";
+
+	/** 
+	 * Table name to write events. Used only for CREATE TABLE if {@link $createTable} is true.
+	 * @var string 
+	 */
+	private $table = 'log4php_log';
+	
+	/** 
+	 * The PDO instance.
+	 * @var PDO 
+	 */
+	private $db = null;
+	
+	/** 
+	 * Prepared statement for the INSERT INTO query.
+	 * @var PDOStatement 
+	 */
+	private $preparedInsert;
+
+	/** 
+	 * Set in activateOptions() and later used in append() to check if all conditions to append are true.
+	 * @var boolean 
+	 */
+	private $canAppend = true;
+	
+	/**
+	 * Constructor.
+	 * This apender doesn't require a layout.
+	 * @param string $name appender name
+	 */
+	public function __construct($name = '') {
+		parent::__construct($name);
+		$this->requiresLayout = false;
+	}
+	
 	public function __destruct() {
-       $this->close();
+	   $this->close();
    	}
    	
-    /**
-     * Setup db connection.
-     * Based on defined options, this method connects to db defined in {@link $dsn}
-     * and creates a {@link $table} table if {@link $createTable} is true.
-     * @return boolean true if all ok.
-     * @throws a PDOException if the attempt to connect to the requested database fails.
-     */
-    public function activateOptions() {
-        try {
-        	if($this->user === null) {
-	           	$this->db = new PDO($this->dsn);
-    	   } else if($this->password === null) {
-    	       $this->db = new PDO($this->dsn, $this->user);
-    	   } else {
-    	       $this->db = new PDO($this->dsn,$this->user,$this->password);
-    	   }
-    	   $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-    	
-            // test if log table exists
-            try {
-                $result = $this->db->query('SELECT * FROM ' . $this->table . ' WHERE 1 = 0');
-                $result->closeCursor(); 
-            } catch (PDOException $e) {
-                // It could be something else but a "no such table" is the most likely
-                $result = false;
-            }
-            
-            // create table if necessary
-            if ($result == false and $this->createTable) {
-                // The syntax should at least be compatible with MySQL, PostgreSQL, SQLite and Oracle.
-                $query = "CREATE TABLE {$this->table} (".
-                            "timestamp varchar(32)," .
-            				"logger varchar(64)," .
-            										"level varchar(32)," .
-            				"message varchar(9999)," .
-            										"thread varchar(32)," .
-            				"file varchar(255)," .
-            				"line varchar(6))";
-                $result = $this->db->query($query);
-            }
-        } catch (PDOException $e) {
-            $this->canAppend = false;
-            throw new LoggerException($e);
-        }
-        
-        $this->layout = new LoggerLayoutPattern();
-        
-        //
-        // Keep compatibility to legacy option $sql which already included the format patterns!
-        //
-        if (empty($this->sql)) {
-            // new style with prepared Statment and $insertSql and $insertPattern
-            // Maybe the tablename has to be substituted.
-            $this->insertSql = preg_replace('/__TABLE__/', $this->table, $this->insertSql);
-            $this->preparedInsert = $this->db->prepare($this->insertSql);
-            $this->layout->setConversionPattern($this->insertPattern);
-        } else {
-            // Old style with format strings in the $sql query should be used.
-        $this->layout->setConversionPattern($this->sql);
-        }
-
-        $this->canAppend = true;
-        return true;
-    }
-    
-    /**
-     * Appends a new event to the database.
-     * 
-     * @throws LoggerException      If the pattern conversion or the INSERT statement fails.
-     */
-    public function append(LoggerLoggingEvent $event) {
-        // TODO: Can't activateOptions() simply throw an Exception if it encounters problems?
-        if ( ! $this->canAppend) return;
-
-            try {
-            if (empty($this->sql)) {
-                // new style with prepared statement
-                $params = $this->layout->formatToArray($event);
-                $this->preparedInsert->execute($params);
-            } else {
-                // old style
-                $query = $this->layout->format($event);
-                $this->db->exec($query);
-            }
-            } catch (Exception $e) {
-                throw new LoggerException($e);
-            }
-        }
-    
-    /**
-     * Closes the connection to the logging database
-     */
-    public function close() {
-    	if($this->closed != true) {
-        	if ($this->db !== null) {
-            	$this->db = null;
-        	}
-        	$this->closed = true;
-    	}
-    }
-    
-    /**
-     * Sets the username for this connection. 
-     * Defaults to ''
-     */
-    public function setUser($user) {
-        $this->user = $user;
-    }
-    
-    /**
-     * Sets the password for this connection. 
-     * Defaults to ''
-     */
-    public function setPassword($password) {
-        $this->password = $password;
-    }
-    
-    /**
-     * Indicator if the logging table should be created on startup,
-     * if its not existing.
-     */
-    public function setCreateTable($flag) {
-        $this->createTable = LoggerOptionConverter::toBoolean($flag, true);
-    }
+	/**
+	 * Setup db connection.
+	 * Based on defined options, this method connects to db defined in {@link $dsn}
+	 * and creates a {@link $table} table if {@link $createTable} is true.
+	 * @return boolean true if all ok.
+	 * @throws a PDOException if the attempt to connect to the requested database fails.
+	 */
+	public function activateOptions() {
+		try {
+			if($this->user === null) {
+				$this->db = new PDO($this->dsn);
+			} else if($this->password === null) {
+				$this->db = new PDO($this->dsn, $this->user);
+			} else {
+				$this->db = new PDO($this->dsn,$this->user,$this->password);
+			}
+			$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+			
+			// test if log table exists
+			try {
+				$result = $this->db->query('SELECT * FROM ' . $this->table . ' WHERE 1 = 0');
+				$result->closeCursor(); 
+			} catch (PDOException $e) {
+				// It could be something else but a "no such table" is the most likely
+				$result = false;
+			}
+			
+			// create table if necessary
+			if ($result == false and $this->createTable) {
+				// The syntax should at least be compatible with MySQL, PostgreSQL, SQLite and Oracle.
+				$query = "CREATE TABLE {$this->table} (".
+							"timestamp varchar(32)," .
+							"logger varchar(64)," .
+							"level varchar(32)," .
+							"message varchar(9999)," .
+							"thread varchar(32)," .
+							"file varchar(255)," .
+							"line varchar(6))";
+				$result = $this->db->query($query);
+			}
+		} catch (PDOException $e) {
+			$this->canAppend = false;
+			throw new LoggerException($e);
+		}
+		
+		$this->layout = new LoggerLayoutPattern();
+		
+		//
+		// Keep compatibility to legacy option $sql which already included the format patterns!
+		//
+		if (empty($this->sql)) {
+			// new style with prepared Statment and $insertSql and $insertPattern
+			// Maybe the tablename has to be substituted.
+			$this->insertSql = preg_replace('/__TABLE__/', $this->table, $this->insertSql);
+			$this->preparedInsert = $this->db->prepare($this->insertSql);
+			$this->layout->setConversionPattern($this->insertPattern);
+		} else {
+			// Old style with format strings in the $sql query should be used.
+		$this->layout->setConversionPattern($this->sql);
+		}
+
+		$this->canAppend = true;
+		return true;
+	}
+	
+	/**
+	 * Appends a new event to the database.
+	 * 
+	 * @throws LoggerException If the pattern conversion or the INSERT statement fails.
+	 */
+	public function append(LoggerLoggingEvent $event) {
+		// TODO: Can't activateOptions() simply throw an Exception if it encounters problems?
+		if ( ! $this->canAppend) return;
+
+			try {
+			if (empty($this->sql)) {
+				// new style with prepared statement
+				$params = $this->layout->formatToArray($event);
+				$this->preparedInsert->execute($params);
+			} else {
+				// old style
+				$query = $this->layout->format($event);
+				$this->db->exec($query);
+			}
+			} catch (Exception $e) {
+				throw new LoggerException($e);
+			}
+		}
+	
+	/**
+	 * Closes the connection to the logging database
+	 */
+	public function close() {
+		if($this->closed != true) {
+			if ($this->db !== null) {
+				$this->db = null;
+			}
+			$this->closed = true;
+		}
+	}
+	
+	/**
+	 * Sets the username for this connection. 
+	 * Defaults to ''
+	 */
+	public function setUser($user) {
+		$this->user = $user;
+	}
+	
+	/**
+	 * Sets the password for this connection. 
+	 * Defaults to ''
+	 */
+	public function setPassword($password) {
+		$this->password = $password;
+	}
+	
+	/**
+	 * Indicator if the logging table should be created on startup,
+	 * if its not existing.
+	 */
+	public function setCreateTable($flag) {
+		$this->createTable = LoggerOptionConverter::toBoolean($flag, true);
+	}
    
    	/**
-     * Sets the SQL string into which the event should be transformed.
-     * Defaults to:
-     * 
-     * INSERT INTO $this->table 
-     * ( timestamp, logger, level, message, thread, file, line) 
-     * VALUES 
-     * ('%d','%c','%p','%m','%t','%F','%L')
-     * 
-     * It's not necessary to change this except you have customized logging'
-     *
-     * @deprecated See {@link setInsertSql} and {@link setInsertPattern}.
-     */
-    public function setSql($sql) {
-        $this->sql = $sql;    
-    }
-    
-    /**
-     * Sets the SQL INSERT string to use with {@link $insertPattern}.
-     *
-     * @param $sql          A complete INSERT INTO query with "?" that gets replaced.
-     */
-    public function setInsertSql($sql) {
-        $this->insertSql = $sql;
-    }
-
-    /**
-     * Sets the {@link LoggerLayoutPattern} format strings for {@link $insertSql}.
-     *
-     * It's not necessary to change this except you have customized logging.
-     *
-     * @param $pattern          Comma separated format strings like "%p,%m,%C"
-     */
-    public function setInsertPattern($pattern) {
-        $this->insertPattern = $pattern;
-    }
-
-    /**
-     * Sets the tablename to which this appender should log.
-     * Defaults to log4php_log
-     */
-    public function setTable($table) {
-        $this->table = $table;
-    }
-    
-    /**
-     * Sets the DSN string for this connection. In case of
-     * SQLite it could look like this: 'sqlite:appenders/pdotest.sqlite'
-     */
-    public function setDSN($dsn) {
-        $this->dsn = $dsn;
-    }
-    
-    /**
-     * Sometimes databases allow only one connection to themselves in one thread.
-     * SQLite has this behaviour. In that case this handle is needed if the database
-     * must be checked for events.
-     *
-     * @return PDO
-     */
-    public function getDatabaseHandle() {
-        return $this->db;
-    }
+	 * Sets the SQL string into which the event should be transformed.
+	 * Defaults to:
+	 * 
+	 * INSERT INTO $this->table 
+	 * ( timestamp, logger, level, message, thread, file, line) 
+	 * VALUES 
+	 * ('%d','%c','%p','%m','%t','%F','%L')
+	 * 
+	 * It's not necessary to change this except you have customized logging'
+	 *
+	 * @deprecated See {@link setInsertSql} and {@link setInsertPattern}.
+	 */
+	public function setSql($sql) {
+		$this->sql = $sql;	
+	}
+	
+	/**
+	 * Sets the SQL INSERT string to use with {@link $insertPattern}.
+	 *
+	 * @param $sql		  A complete INSERT INTO query with "?" that gets replaced.
+	 */
+	public function setInsertSql($sql) {
+		$this->insertSql = $sql;
+	}
+
+	/**
+	 * Sets the {@link LoggerLayoutPattern} format strings for {@link $insertSql}.
+	 *
+	 * It's not necessary to change this except you have customized logging.
+	 *
+	 * @param $pattern		  Comma separated format strings like "%p,%m,%C"
+	 */
+	public function setInsertPattern($pattern) {
+		$this->insertPattern = $pattern;
+	}
+
+	/**
+	 * Sets the tablename to which this appender should log.
+	 * Defaults to log4php_log
+	 */
+	public function setTable($table) {
+		$this->table = $table;
+	}
+	
+	/**
+	 * Sets the DSN string for this connection. In case of
+	 * SQLite it could look like this: 'sqlite:appenders/pdotest.sqlite'
+	 */
+	public function setDSN($dsn) {
+		$this->dsn = $dsn;
+	}
+	
+	/**
+	 * Sometimes databases allow only one connection to themselves in one thread.
+	 * SQLite has this behaviour. In that case this handle is needed if the database
+	 * must be checked for events.
+	 *
+	 * @return PDO
+	 */
+	public function getDatabaseHandle() {
+		return $this->db;
+	}
 }
 

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderPhp.php Sat Jan 15 10:56:23 2011
@@ -46,8 +46,8 @@ class LoggerAppenderPhp extends LoggerAp
 	}
 	
 	public function __destruct() {
-       $this->close();
-   	}
+		$this->close();
+	}
 	
 	public function activateOptions() {
 		$this->closed = false;

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderRollingFile.php Sat Jan 15 10:56:23 2011
@@ -87,9 +87,9 @@ class LoggerAppenderRollingFile extends 
 	private $expandedFileName = null;
 
 	public function __destruct() {
-       parent::__destruct();
-   	}
-   	
+		parent::__destruct();
+	}
+	
 	/**
 	 * Returns the value of the MaxBackupIndex option.
 	 * @return integer 

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSocket.php Sat Jan 15 10:56:23 2011
@@ -95,9 +95,9 @@ class LoggerAppenderSocket extends Logge
 	private $dry = false;
 	
 	public function __destruct() {
-       $this->close();
-   	}
-   	
+		$this->close();
+	}
+	
 	/**
 	 * Create a socket connection using defined parameters
 	 */
@@ -105,7 +105,7 @@ class LoggerAppenderSocket extends Logge
 		if(!$this->dry) {
 			$this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout());
 			if ($this->sp === false) {
-			    throw new LoggerException("Could not open socket to ".$this->getRemoteHost().":".$this->getPort().": $errstr ($errno)");
+				throw new LoggerException("Could not open socket to ".$this->getRemoteHost().":".$this->getPort().": $errstr ($errno)");
 			}
 		}
 		if($this->getUseXml()) {
@@ -118,7 +118,7 @@ class LoggerAppenderSocket extends Logge
 				$this->xmlLayout->activateOptions();
 			}			 
 		}
-        $this->closed = false;
+		$this->closed = false;
 	}
 	
 	public function close() {
@@ -241,20 +241,20 @@ class LoggerAppenderSocket extends Logge
 				if(!$this->dry) {
 					fwrite($this->sp, $sEvent, strlen($sEvent));
 				} else {
-				    echo "DRY MODE OF SOCKET APPENDER: ".$sEvent;
+					echo "DRY MODE OF SOCKET APPENDER: ".$sEvent;
 				}
 			} else {
 				if(!$this->dry) {
 					fwrite($this->sp, $this->xmlLayout->format($event));
 				} else {
-				    echo "DRY MODE OF SOCKET APPENDER: ".$this->xmlLayout->format($event);
+					echo "DRY MODE OF SOCKET APPENDER: ".$this->xmlLayout->format($event);
 				}
-			}			 
+			}
 
 			// not sure about it...
 			if(!$this->dry) {
 				fflush($this->sp);
 			}
-		} 
+		}
 	}
 }

Modified: logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php (original)
+++ logging/log4php/trunk/src/main/php/appenders/LoggerAppenderSyslog.php Sat Jan 15 10:56:23 2011
@@ -89,7 +89,7 @@ class LoggerAppenderSyslog extends Logge
 	 * If it is necessary to define logging priority in the .properties-file,
 	 * set this variable to "true".
 	 *
-	 * @var const int  value indicating whether the priority of the message is defined in the .properties-file
+	 * @var const int value indicating whether the priority of the message is defined in the .properties-file
 	 *				   (or properties-array)
 	 */
 	private $_overridePriority;
@@ -103,10 +103,10 @@ class LoggerAppenderSyslog extends Logge
 	}
 
 	public function __destruct() {
-       $this->close();
-   	}
-   	
-   	public function setDry($dry) {
+		$this->close();
+	}
+	
+	public function setDry($dry) {
 		$this->dry = $dry;
 	}
 	
@@ -145,7 +145,7 @@ class LoggerAppenderSyslog extends Logge
 	 * @param bool Override priority
 	 */
 	public function setOverridePriority($overridePriority) {
-		$this->_overridePriority = $overridePriority;							
+		$this->_overridePriority = $overridePriority;
 	} 
 	
 	/**
@@ -155,8 +155,8 @@ class LoggerAppenderSyslog extends Logge
 	 *
 	 * @param string	$option
 	 */
-	public function setOption($option) {	  
-		$this->_option = $option;		
+	public function setOption($option) {
+		$this->_option = $option;
 	}
 	
 	public function activateOptions() {
@@ -209,7 +209,7 @@ class LoggerAppenderSyslog extends Logge
 			}
 			closelog();
 		} else {
-		      echo "DRY MODE OF SYSLOG APPENDER: ".$message;
+			echo "DRY MODE OF SYSLOG APPENDER: ".$message;
 		}
 	}
 }

Modified: logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php (original)
+++ logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorIni.php Sat Jan 15 10:56:23 2011
@@ -292,7 +292,7 @@ class LoggerConfiguratorIni implements L
 		}
 		
 		return $this->doConfigureProperties($properties, $hierarchy);
-	} 
+	}
 
 	/**
 	 * Read configuration options from <b>properties</b>.
@@ -457,11 +457,11 @@ class LoggerConfiguratorIni implements L
 				}
 			}
 			
-			LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix . ".");				  
+			LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix . ".");
 			$appender->setLayout($layout);
 			
 		}
 		LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix . ".");
-		return $appender;		 
+		return $appender;
 	}
 }

Modified: logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php (original)
+++ logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorPhp.php Sat Jan 15 10:56:23 2011
@@ -47,7 +47,7 @@ class LoggerConfiguratorPhp implements L
 		if (!is_array($url)) {
  			$config = require $url;
  		} else {
- 		    $config = $url;
+ 			$config = $url;
  		}
 		
 		// set threshold
@@ -70,7 +70,7 @@ class LoggerConfiguratorPhp implements L
 					if(isset($appenderProperties['layout'])) {
 						
 						if(isset($appenderProperties['layout']['class']) and !empty($appenderProperties['layout']['class'])) {
-							$layoutClass = $appenderProperties['layout']['class'];							
+							$layoutClass = $appenderProperties['layout']['class'];
 						} else {
 							$layoutClass = 'LoggerLayoutSimple';
 						}

Modified: logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php (original)
+++ logging/log4php/trunk/src/main/php/configurators/LoggerConfiguratorXml.php Sat Jan 15 10:56:23 2011
@@ -58,13 +58,13 @@ class LoggerConfiguratorXml implements L
 	const DEFAULT_CONFIGURATION = 
 	'<?xml version="1.0" ?>
 	<log4php:configuration threshold="all">
-	    <appender name="A1" class="LoggerAppenderEcho">
-	        <layout class="LoggerLayoutSimple" />
-	    </appender>
-	    <root>
-	        <level value="debug" />
-	        <appender_ref ref="A1" />
-	    </root>
+		<appender name="A1" class="LoggerAppenderEcho">
+			<layout class="LoggerLayoutSimple" />
+		</appender>
+		<root>
+			<level value="debug" />
+			<appender_ref ref="A1" />
+		</root>
 	</log4php:configuration>';
 	
 	/**
@@ -72,370 +72,370 @@ class LoggerConfiguratorXml implements L
 	 */
 	const XMLNS = 'HTTP://LOGGING.APACHE.ORG/LOG4PHP/'; 
 
-    /**
-     * @var LoggerHierarchy
-     */
-    private $repository;
-    
-    /**
-     * @var array state stack 
-     */
-    private $state;
-
-    /**
-     * @var Logger parsed Logger  
-     */
-    private $logger;
-    
-    /**
-     * @var LoggerAppender parsed LoggerAppender 
-     */
-    private $appender;
-    
-    /**
-     * @var LoggerFilter parsed LoggerFilter 
-     */
-    private $filter;
-    
-    /**
-     * @var LoggerLayout parsed LoggerLayout 
-     */
-    private $layout;
-    
-    /**
-     * Constructor
-     */
-    public function __construct() {
-        $this->state    = array();
-        $this->logger   = null;
-        $this->appender = null;
-        $this->filter   = null;
-        $this->layout   = null;
-    }
-    
-    /**
-     * Configure the default repository using the resource pointed by <b>url</b>.
-     * <b>Url</b> is any valid resource as defined in {@link PHP_MANUAL#file} function.
-     * Note that the resource will be search with <i>use_include_path</i> parameter 
-     * set to "1".
-     *
-     * @param string $url
-     * @static
-     */
-    public function configure(LoggerHierarchy $hierarchy, $url = '') {
-        return $this->doConfigure($url, $hierarchy);
-    }
-    
-    /**
-     * Configure the given <b>repository</b> using the resource pointed by <b>url</b>.
-     * <b>Url</b> is any valid resurce as defined in {@link PHP_MANUAL#file} function.
-     * Note that the resource will be search with <i>use_include_path</i> parameter 
-     * set to "1".
-     *
-     * @param string $url
-     * @param LoggerHierarchy $repository
-     */
-    private function doConfigure($url = '', LoggerHierarchy $repository)
-    {
-        $xmlData = '';
-        if (!empty($url))
-            $xmlData = implode('', file($url, 1));
-        return $this->doConfigureByString($xmlData, $repository);
-    }
-    
-    /**
-     * Configure the given <b>repository</b> using the configuration written in <b>xmlData</b>.
-     * Do not call this method directly. Use {@link doConfigure()} instead.
-     * @param string $xmlData
-     * @param LoggerHierarchy $repository
-     */
-    private function doConfigureByString($xmlData, LoggerHierarchy $repository)
-    {
-        return $this->parse($xmlData, $repository);
-    }
-    
-    /**
-     * @param LoggerHierarchy $repository
-     */
-    private function doConfigureDefault(LoggerHierarchy $repository)
-    {
-        return $this->doConfigureByString(self::DEFAULT_CONFIGURATION, $repository);
-    }
-    
-    /**
-     * @param string $xmlData
-     */
-    private function parse($xmlData, LoggerHierarchy $repository)
-    {
-        // Logger::resetConfiguration();
-        $this->repository = $repository;
+	/**
+	 * @var LoggerHierarchy
+	 */
+	private $repository;
+	
+	/**
+	 * @var array state stack 
+	 */
+	private $state;
 
-        $parser = xml_parser_create_ns();
-    
-        xml_set_object($parser, $this);
-        xml_set_element_handler($parser, "tagOpen", "tagClose");
-        
-        $result = xml_parse($parser, $xmlData, true);
-        if (!$result) {
-            $errorCode = xml_get_error_code($parser);
-            $errorStr = xml_error_string($errorCode);
-            $errorLine = xml_get_current_line_number($parser);
-            $this->repository->resetConfiguration();
-        } else {
-            xml_parser_free($parser);
-        }
-        return $result;
-    }
-    
-    /**
-     * @param mixed $parser
-     * @param string $tag
-     * @param array $attribs
-     *
-     * @todo In 'LOGGER' case find a better way to detect 'getLogger()' method
-     */
-    private function tagOpen($parser, $tag, $attribs)
-    {
-        switch ($tag) {
-        
-            case 'CONFIGURATION' :
-            case self::XMLNS.':CONFIGURATION':
-            
-                if (isset($attribs['THRESHOLD'])) {
-                
-                    $this->repository->setThreshold(
-                        LoggerOptionConverter::toLevel(
-                            $this->subst($attribs['THRESHOLD']), 
-                            $this->repository->getThreshold()
-                        )
-                    );
-                }
-                break;
-                
-            case 'APPENDER' :
-            case self::XMLNS.':APPENDER':
-            
-                unset($this->appender);
-                $this->appender = null;
-                
-                $name  = $this->subst(@$attribs['NAME']);
-                $class = $this->subst(@$attribs['CLASS']);
-                
-                $this->appender = LoggerAppenderPool::getAppenderFromPool($name, $class);
-                
-                if (isset($attribs['THRESHOLD'])) {
-                    $this->appender->setThreshold(
-                        LoggerOptionConverter::toLevel(
-                            $this->subst($attribs['THRESHOLD']), $this->appender->getThreshold()));
-                }
-                
-                $this->state[] = self::APPENDER_STATE;
-                break;
-                
-            case 'APPENDER_REF' :
-            case 'APPENDER-REF' :
-            case self::XMLNS.':APPENDER_REF':
-            case self::XMLNS.':APPENDER-REF':
-                if (isset($attribs['REF']) and !empty($attribs['REF'])) {
-                    $appenderName = $this->subst($attribs['REF']);
-                    
-                    $appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
-                    if ($appender !== null) {
-                        switch (end($this->state)) {
-                            case self::LOGGER_STATE:
-                            case self::ROOT_STATE:                
-                                $this->logger->addAppender($appender);
-                                break;
-                        }
-                    }
-                } 
-                break;
-                
-            case 'FILTER' :
-            case self::XMLNS.':FILTER':
-                unset($this->filter);
-                $this->filter = null;
+	/**
+	 * @var Logger parsed Logger  
+	 */
+	private $logger;
+	
+	/**
+	 * @var LoggerAppender parsed LoggerAppender 
+	 */
+	private $appender;
+	
+	/**
+	 * @var LoggerFilter parsed LoggerFilter 
+	 */
+	private $filter;
+	
+	/**
+	 * @var LoggerLayout parsed LoggerLayout 
+	 */
+	private $layout;
+	
+	/**
+	 * Constructor
+	 */
+	public function __construct() {
+		$this->state	= array();
+		$this->logger   = null;
+		$this->appender = null;
+		$this->filter   = null;
+		$this->layout   = null;
+	}
+	
+	/**
+	 * Configure the default repository using the resource pointed by <b>url</b>.
+	 * <b>Url</b> is any valid resource as defined in {@link PHP_MANUAL#file} function.
+	 * Note that the resource will be search with <i>use_include_path</i> parameter 
+	 * set to "1".
+	 *
+	 * @param string $url
+	 * @static
+	 */
+	public function configure(LoggerHierarchy $hierarchy, $url = '') {
+		return $this->doConfigure($url, $hierarchy);
+	}
+	
+	/**
+	 * Configure the given <b>repository</b> using the resource pointed by <b>url</b>.
+	 * <b>Url</b> is any valid resurce as defined in {@link PHP_MANUAL#file} function.
+	 * Note that the resource will be search with <i>use_include_path</i> parameter 
+	 * set to "1".
+	 *
+	 * @param string $url
+	 * @param LoggerHierarchy $repository
+	 */
+	private function doConfigure($url = '', LoggerHierarchy $repository)
+	{
+		$xmlData = '';
+		if (!empty($url))
+			$xmlData = implode('', file($url, 1));
+		return $this->doConfigureByString($xmlData, $repository);
+	}
+	
+	/**
+	 * Configure the given <b>repository</b> using the configuration written in <b>xmlData</b>.
+	 * Do not call this method directly. Use {@link doConfigure()} instead.
+	 * @param string $xmlData
+	 * @param LoggerHierarchy $repository
+	 */
+	private function doConfigureByString($xmlData, LoggerHierarchy $repository)
+	{
+		return $this->parse($xmlData, $repository);
+	}
+	
+	/**
+	 * @param LoggerHierarchy $repository
+	 */
+	private function doConfigureDefault(LoggerHierarchy $repository)
+	{
+		return $this->doConfigureByString(self::DEFAULT_CONFIGURATION, $repository);
+	}
+	
+	/**
+	 * @param string $xmlData
+	 */
+	private function parse($xmlData, LoggerHierarchy $repository)
+	{
+		// Logger::resetConfiguration();
+		$this->repository = $repository;
 
-                $filterName = basename($this->subst(@$attribs['CLASS']));
-                if (!empty($filterName)) {
-                    $this->filter = new $filterName();
-                    $this->state[] = self::FILTER_STATE;
-                } 
-                break;
-                
-            case 'LAYOUT':
-            case self::XMLNS.':LAYOUT':
-                $class = @$attribs['CLASS'];
-                $this->layout = LoggerReflectionUtils::createObject($this->subst($class));
-                $this->state[] = self::LAYOUT_STATE;
-                break;
-            
-            case 'LOGGER':
-            case self::XMLNS.':LOGGER':
-                // $this->logger is assigned by reference.
-                // Only '$this->logger=null;' destroys referenced object
-                unset($this->logger);
-                $this->logger = null;
-                
-                $loggerName = $this->subst(@$attribs['NAME']);
-                if (!empty($loggerName)) {
-                    $this->logger = $this->repository->getLogger($loggerName);
-                    if ($this->logger !== null and isset($attribs['ADDITIVITY'])) {
-                        $additivity = LoggerOptionConverter::toBoolean($this->subst($attribs['ADDITIVITY']), true);     
-                        $this->logger->setAdditivity($additivity);
-                    }
-                } 
-                $this->state[] = self::LOGGER_STATE;;
-                break;
-            
-            case 'LEVEL':
-            case self::XMLNS.':LEVEL':
-            case 'PRIORITY':
-            case self::XMLNS.':PRIORITY':
-            
-                if (!isset($attribs['VALUE'])) {
-                    // LoggerDOMConfigurator::tagOpen() LEVEL value not set
-                    break;
-                }
-                    
-                if ($this->logger === null) { 
-                    // LoggerDOMConfigurator::tagOpen() LEVEL. parent logger is null
-                    break;
-                }
-        
-                switch (end($this->state)) {
-                    case self::ROOT_STATE:
-                        $this->logger->setLevel(
-                            LoggerOptionConverter::toLevel(
-                                $this->subst($attribs['VALUE']), 
-                                $this->logger->getLevel()
-                            )
-                        );
-                        break;
-                    case self::LOGGER_STATE:
-                        $this->logger->setLevel(
-                            LoggerOptionConverter::toLevel(
-                                $this->subst($attribs['VALUE']), 
-                                $this->logger->getLevel()
-                            )
-                        );
-                        break;
-                    default:
-                        //LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LEVEL state '{$this->state}' not allowed here");
-                }
-                break;
-            
-            case 'PARAM':
-            case self::XMLNS.':PARAM':
-                if (!isset($attribs['NAME'])) {
-                    // LoggerDOMConfigurator::tagOpen() PARAM attribute 'name' not defined.
-                    break;
-                }
-                if (!isset($attribs['VALUE'])) {
-                    // LoggerDOMConfigurator::tagOpen() PARAM. attribute 'value' not defined.
-                    break;
-                }
-                    
-                switch (end($this->state)) {
-                    case self::APPENDER_STATE:
-                        if ($this->appender !== null) {
-                            LoggerReflectionUtils::setter($this->appender, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
-                        }
-                        break;
-                    case self::LAYOUT_STATE:
-                        if ($this->layout !== null) {
-                            LoggerReflectionUtils::setter($this->layout, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));                
-                        }
-                        break;
-                    case self::FILTER_STATE:
-                        if ($this->filter !== null) {
-                            LoggerReflectionUtils::setter($this->filter, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
-                        }
-                        break;
-                    default:
-                        //LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM state '{$this->state}' not allowed here");
-                }
-                break;
-            
-            case 'RENDERER':
-            case self::XMLNS.':RENDERER':
+		$parser = xml_parser_create_ns();
+	
+		xml_set_object($parser, $this);
+		xml_set_element_handler($parser, "tagOpen", "tagClose");
+		
+		$result = xml_parse($parser, $xmlData, true);
+		if (!$result) {
+			$errorCode = xml_get_error_code($parser);
+			$errorStr = xml_error_string($errorCode);
+			$errorLine = xml_get_current_line_number($parser);
+			$this->repository->resetConfiguration();
+		} else {
+			xml_parser_free($parser);
+		}
+		return $result;
+	}
+	
+	/**
+	 * @param mixed $parser
+	 * @param string $tag
+	 * @param array $attribs
+	 *
+	 * @todo In 'LOGGER' case find a better way to detect 'getLogger()' method
+	 */
+	private function tagOpen($parser, $tag, $attribs)
+	{
+		switch ($tag) {
+		
+			case 'CONFIGURATION' :
+			case self::XMLNS.':CONFIGURATION':
+			
+				if (isset($attribs['THRESHOLD'])) {
+				
+					$this->repository->setThreshold(
+						LoggerOptionConverter::toLevel(
+							$this->subst($attribs['THRESHOLD']), 
+							$this->repository->getThreshold()
+						)
+					);
+				}
+				break;
+				
+			case 'APPENDER' :
+			case self::XMLNS.':APPENDER':
+			
+				unset($this->appender);
+				$this->appender = null;
+				
+				$name  = $this->subst(@$attribs['NAME']);
+				$class = $this->subst(@$attribs['CLASS']);
+				
+				$this->appender = LoggerAppenderPool::getAppenderFromPool($name, $class);
+				
+				if (isset($attribs['THRESHOLD'])) {
+					$this->appender->setThreshold(
+						LoggerOptionConverter::toLevel(
+							$this->subst($attribs['THRESHOLD']), $this->appender->getThreshold()));
+				}
+				
+				$this->state[] = self::APPENDER_STATE;
+				break;
+				
+			case 'APPENDER_REF' :
+			case 'APPENDER-REF' :
+			case self::XMLNS.':APPENDER_REF':
+			case self::XMLNS.':APPENDER-REF':
+				if (isset($attribs['REF']) and !empty($attribs['REF'])) {
+					$appenderName = $this->subst($attribs['REF']);
+					
+					$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
+					if ($appender !== null) {
+						switch (end($this->state)) {
+							case self::LOGGER_STATE:
+							case self::ROOT_STATE:
+								$this->logger->addAppender($appender);
+								break;
+						}
+					}
+				} 
+				break;
+				
+			case 'FILTER' :
+			case self::XMLNS.':FILTER':
+				unset($this->filter);
+				$this->filter = null;
+				
+				$filterName = basename($this->subst(@$attribs['CLASS']));
+				if (!empty($filterName)) {
+					$this->filter = new $filterName();
+					$this->state[] = self::FILTER_STATE;
+				} 
+				break;
+				
+			case 'LAYOUT':
+			case self::XMLNS.':LAYOUT':
+				$class = @$attribs['CLASS'];
+				$this->layout = LoggerReflectionUtils::createObject($this->subst($class));
+				$this->state[] = self::LAYOUT_STATE;
+				break;
+			
+			case 'LOGGER':
+			case self::XMLNS.':LOGGER':
+				// $this->logger is assigned by reference.
+				// Only '$this->logger=null;' destroys referenced object
+				unset($this->logger);
+				$this->logger = null;
+				
+				$loggerName = $this->subst(@$attribs['NAME']);
+				if (!empty($loggerName)) {
+					$this->logger = $this->repository->getLogger($loggerName);
+					if ($this->logger !== null and isset($attribs['ADDITIVITY'])) {
+						$additivity = LoggerOptionConverter::toBoolean($this->subst($attribs['ADDITIVITY']), true);	 
+						$this->logger->setAdditivity($additivity);
+					}
+				} 
+				$this->state[] = self::LOGGER_STATE;;
+				break;
+			
+			case 'LEVEL':
+			case self::XMLNS.':LEVEL':
+			case 'PRIORITY':
+			case self::XMLNS.':PRIORITY':
+			
+				if (!isset($attribs['VALUE'])) {
+					// LoggerDOMConfigurator::tagOpen() LEVEL value not set
+					break;
+				}
+					
+				if ($this->logger === null) { 
+					// LoggerDOMConfigurator::tagOpen() LEVEL. parent logger is null
+					break;
+				}
+				
+				switch (end($this->state)) {
+					case self::ROOT_STATE:
+						$this->logger->setLevel(
+							LoggerOptionConverter::toLevel(
+								$this->subst($attribs['VALUE']), 
+								$this->logger->getLevel()
+							)
+						);
+						break;
+					case self::LOGGER_STATE:
+						$this->logger->setLevel(
+							LoggerOptionConverter::toLevel(
+								$this->subst($attribs['VALUE']), 
+								$this->logger->getLevel()
+							)
+						);
+						break;
+					default:
+						//LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LEVEL state '{$this->state}' not allowed here");
+				}
+				break;
+			
+			case 'PARAM':
+			case self::XMLNS.':PARAM':
+				if (!isset($attribs['NAME'])) {
+					// LoggerDOMConfigurator::tagOpen() PARAM attribute 'name' not defined.
+					break;
+				}
+				if (!isset($attribs['VALUE'])) {
+					// LoggerDOMConfigurator::tagOpen() PARAM. attribute 'value' not defined.
+					break;
+				}
+					
+				switch (end($this->state)) {
+					case self::APPENDER_STATE:
+						if ($this->appender !== null) {
+							LoggerReflectionUtils::setter($this->appender, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
+						}
+						break;
+					case self::LAYOUT_STATE:
+						if ($this->layout !== null) {
+							LoggerReflectionUtils::setter($this->layout, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
+						}
+						break;
+					case self::FILTER_STATE:
+						if ($this->filter !== null) {
+							LoggerReflectionUtils::setter($this->filter, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
+						}
+						break;
+					default:
+						//LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM state '{$this->state}' not allowed here");
+				}
+				break;
+			
+			case 'RENDERER':
+			case self::XMLNS.':RENDERER':
 
-                $renderedClass   = $this->subst(@$attribs['RENDEREDCLASS']);
-                $renderingClass  = $this->subst(@$attribs['RENDERINGCLASS']);
-        
-                if (!empty($renderedClass) and !empty($renderingClass)) {
-                    $this->repository->getRendererMap()->addRenderer($renderedClass, $renderingClass);
-                }
-                break;
-            
-            case 'ROOT':
-            case self::XMLNS.':ROOT':
-                $this->logger = Logger::getRootLogger();
-                $this->state[] = self::ROOT_STATE;
-                break;
-        }
-    }
+				$renderedClass   = $this->subst(@$attribs['RENDEREDCLASS']);
+				$renderingClass  = $this->subst(@$attribs['RENDERINGCLASS']);
+		
+				if (!empty($renderedClass) and !empty($renderingClass)) {
+					$this->repository->getRendererMap()->addRenderer($renderedClass, $renderingClass);
+				}
+				break;
+			
+			case 'ROOT':
+			case self::XMLNS.':ROOT':
+				$this->logger = Logger::getRootLogger();
+				$this->state[] = self::ROOT_STATE;
+				break;
+		}
+	}
 
 
-    /**
-     * @param mixed $parser
-     * @param string $tag
-     */
-    private function tagClose($parser, $tag)
-    {
-        switch ($tag) {
-        
-            case 'CONFIGURATION' : 
-            case self::XMLNS.':CONFIGURATION':
-                break;
-                
-            case 'APPENDER' :
-            case self::XMLNS.':APPENDER':
-                if ($this->appender !== null) {
-                    if ($this->appender->requiresLayout() and $this->appender->getLayout() === null) {
-                        $appenderName = $this->appender->getName();
-                        $this->appender->setLayout(LoggerReflectionUtils::createObject('LoggerLayoutSimple'));
-                    }                    
-                    $this->appender->activateOptions();
-                }        
-                array_pop($this->state);        
-                break;
-                
-            case 'FILTER' :
-            case self::XMLNS.':FILTER':
-                if ($this->filter !== null) {
-                    $this->filter->activateOptions();
-                    $this->appender->addFilter($this->filter);
-                    $this->filter = null;
-                }
-                array_pop($this->state);        
-                break;
-                
-            case 'LAYOUT':
-            case self::XMLNS.':LAYOUT':
-                if ($this->appender !== null and $this->layout !== null and $this->appender->requiresLayout()) {
-                    $this->layout->activateOptions();
-                    $this->appender->setLayout($this->layout);
-                    $this->layout = null;
-                }
-                array_pop($this->state);
-                break;
-            
-            case 'LOGGER':
-            case self::XMLNS.':LOGGER':
-                array_pop($this->state);
-                break;
-            
-            case 'ROOT':
-            case self::XMLNS.':ROOT':
-                array_pop($this->state);
-                break;
-        }
-    }
-    
-    private function subst($value)
-    {
-        return LoggerOptionConverter::substVars($value);
-    }
+	/**
+	 * @param mixed $parser
+	 * @param string $tag
+	 */
+	private function tagClose($parser, $tag)
+	{
+		switch ($tag) {
+		
+			case 'CONFIGURATION' : 
+			case self::XMLNS.':CONFIGURATION':
+				break;
+				
+			case 'APPENDER' :
+			case self::XMLNS.':APPENDER':
+				if ($this->appender !== null) {
+					if ($this->appender->requiresLayout() and $this->appender->getLayout() === null) {
+						$appenderName = $this->appender->getName();
+						$this->appender->setLayout(LoggerReflectionUtils::createObject('LoggerLayoutSimple'));
+					}					
+					$this->appender->activateOptions();
+				}		
+				array_pop($this->state);
+				break;
+				
+			case 'FILTER' :
+			case self::XMLNS.':FILTER':
+				if ($this->filter !== null) {
+					$this->filter->activateOptions();
+					$this->appender->addFilter($this->filter);
+					$this->filter = null;
+				}
+				array_pop($this->state);
+				break;
+				
+			case 'LAYOUT':
+			case self::XMLNS.':LAYOUT':
+				if ($this->appender !== null and $this->layout !== null and $this->appender->requiresLayout()) {
+					$this->layout->activateOptions();
+					$this->appender->setLayout($this->layout);
+					$this->layout = null;
+				}
+				array_pop($this->state);
+				break;
+			
+			case 'LOGGER':
+			case self::XMLNS.':LOGGER':
+				array_pop($this->state);
+				break;
+			
+			case 'ROOT':
+			case self::XMLNS.':ROOT':
+				array_pop($this->state);
+				break;
+		}
+	}
+	
+	private function subst($value)
+	{
+		return LoggerOptionConverter::substVars($value);
+	}
 
 }

Modified: logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php (original)
+++ logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelMatch.php Sat Jan 15 10:56:23 2011
@@ -71,7 +71,7 @@ class LoggerFilterLevelMatch extends Log
 	 */
 	public function setLevelToMatch($l) {
 		if($l instanceof LoggerLevel) {
-		    $this->levelToMatch = $l;
+			$this->levelToMatch = $l;
 		} else {
 			$this->levelToMatch = LoggerOptionConverter::toLevel($l, null);
 		}

Modified: logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php (original)
+++ logging/log4php/trunk/src/main/php/filters/LoggerFilterLevelRange.php Sat Jan 15 10:56:23 2011
@@ -91,7 +91,7 @@ class LoggerFilterLevelRange extends Log
 	 */
 	public function setLevelMin($l) {
 		if($l instanceof LoggerLevel) {
-		    $this->levelMin = $l;
+			$this->levelMin = $l;
 		} else {
 			$this->levelMin = LoggerOptionConverter::toLevel($l, null);
 		}
@@ -102,7 +102,7 @@ class LoggerFilterLevelRange extends Log
 	 */
 	public function setLevelMax($l) {
 		if($l instanceof LoggerLevel) {
-		    $this->levelMax = $l;
+			$this->levelMax = $l;
 		} else {
 			$this->levelMax = LoggerOptionConverter::toLevel($l, null);
 		}

Modified: logging/log4php/trunk/src/main/php/helpers/LoggerBasicPatternConverter.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/helpers/LoggerBasicPatternConverter.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/helpers/LoggerBasicPatternConverter.php (original)
+++ logging/log4php/trunk/src/main/php/helpers/LoggerBasicPatternConverter.php Sat Jan 15 10:56:23 2011
@@ -36,8 +36,8 @@ class LoggerBasicPatternConverter extend
 	 * @param integer $type
 	 */
 	public function __construct($formattingInfo, $type) {
-	  parent::__construct($formattingInfo);
-	  $this->type = $type;
+		parent::__construct($formattingInfo);
+		$this->type = $type;
 	}
 
 	/**

Modified: logging/log4php/trunk/src/main/php/helpers/LoggerFormattingInfo.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/helpers/LoggerFormattingInfo.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/helpers/LoggerFormattingInfo.php (original)
+++ logging/log4php/trunk/src/main/php/helpers/LoggerFormattingInfo.php Sat Jan 15 10:56:23 2011
@@ -40,7 +40,7 @@ class LoggerFormattingInfo {
 	public function reset() {
 		$this->min = -1;
 		$this->max = 0x7FFFFFFF;
-		$this->leftAlign = false;	  
+		$this->leftAlign = false;
 	}
 
 	public function dump() {

Modified: logging/log4php/trunk/src/main/php/helpers/LoggerLocationPatternConverter.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/helpers/LoggerLocationPatternConverter.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/helpers/LoggerLocationPatternConverter.php (original)
+++ logging/log4php/trunk/src/main/php/helpers/LoggerLocationPatternConverter.php Sat Jan 15 10:56:23 2011
@@ -36,8 +36,8 @@ class LoggerLocationPatternConverter ext
 	 * @param integer $type
 	 */
 	public function __construct($formattingInfo, $type) {
-	  parent::__construct($formattingInfo);
-	  $this->type = $type;
+		parent::__construct($formattingInfo);
+		$this->type = $type;
 	}
 
 	/**

Modified: logging/log4php/trunk/src/main/php/helpers/LoggerNamedPatternConverter.php
URL: http://svn.apache.org/viewvc/logging/log4php/trunk/src/main/php/helpers/LoggerNamedPatternConverter.php?rev=1059292&r1=1059291&r2=1059292&view=diff
==============================================================================
--- logging/log4php/trunk/src/main/php/helpers/LoggerNamedPatternConverter.php (original)
+++ logging/log4php/trunk/src/main/php/helpers/LoggerNamedPatternConverter.php Sat Jan 15 10:56:23 2011
@@ -37,8 +37,8 @@ class LoggerNamedPatternConverter extend
 	 * @param integer $precision
 	 */
 	public function __construct($formattingInfo, $precision) {
-	  parent::__construct($formattingInfo);
-	  $this->precision =  $precision;
+		parent::__construct($formattingInfo);
+		$this->precision = $precision;
 	}
 
 	/**