From 653629d70405564cd54a6de8b94f4fcca7acc0c2 Mon Sep 17 00:00:00 2001
From: Uma <uma.s@vtiger.com>
Date: Wed, 27 Jan 2021 20:18:25 +0530
Subject: [PATCH] log4php version upgraded version 2.2.0

---
 libraries/log4php.debug/Logger.php            | 218 ++++----
 libraries/log4php.debug/LoggerAppender.php    | 160 +++---
 .../log4php.debug/LoggerAppenderPool.php      |  85 ++-
 .../log4php.debug/LoggerConfigurable.php      | 119 +++++
 .../log4php.debug/LoggerConfigurator.php      |  43 +-
 libraries/log4php.debug/LoggerFilter.php      |   4 +-
 libraries/log4php.debug/LoggerHierarchy.php   | 136 +++--
 libraries/log4php.debug/LoggerLayout.php      |  10 +-
 libraries/log4php.debug/LoggerLevel.php       |  69 +--
 .../log4php.debug/LoggerLoggingEvent.php      |  12 +-
 libraries/log4php.debug/LoggerMDC.php         |  63 +--
 libraries/log4php.debug/LoggerNDC.php         |  11 +-
 .../log4php.debug/LoggerReflectionUtils.php   |   2 -
 .../appenders/LoggerAppenderAdodb.php         | 263 ----------
 .../appenders/LoggerAppenderConsole.php       |  18 +-
 .../appenders/LoggerAppenderDailyFile.php     |  50 +-
 .../appenders/LoggerAppenderEcho.php          |  21 +-
 .../appenders/LoggerAppenderFile.php          |  24 +-
 .../appenders/LoggerAppenderMail.php          |  39 +-
 .../appenders/LoggerAppenderMailEvent.php     |  43 +-
 .../appenders/LoggerAppenderMongoDB.php       |  20 +-
 .../appenders/LoggerAppenderNull.php          |  17 +-
 .../appenders/LoggerAppenderPDO.php           |  51 +-
 .../appenders/LoggerAppenderPhp.php           |  27 +-
 .../appenders/LoggerAppenderRollingFile.php   |  33 +-
 .../appenders/LoggerAppenderSocket.php        | 261 +++-------
 .../appenders/LoggerAppenderSyslog.php        | 320 ++++++++----
 ...sic.php => LoggerConfigurationAdapter.php} |  87 ++--
 .../LoggerConfigurationAdapterINI.php         | 306 +++++++++++
 .../LoggerConfigurationAdapterPHP.php         |  85 +++
 .../LoggerConfigurationAdapterXML.php         | 258 ++++++++++
 .../LoggerConfiguratorDefault.php             | 485 ++++++++++++++++++
 .../configurators/LoggerConfiguratorIni.php   | 463 -----------------
 .../configurators/LoggerConfiguratorPhp.php   | 159 ------
 .../configurators/LoggerConfiguratorXml.php   | 441 ----------------
 .../filters/LoggerFilterLevelMatch.php        |  16 +-
 .../filters/LoggerFilterLevelRange.php        |  26 +-
 .../filters/LoggerFilterStringMatch.php       |  12 +-
 .../helpers/LoggerNamedPatternConverter.php   |   6 +-
 .../helpers/LoggerOptionConverter.php         | 158 +++++-
 .../helpers/LoggerPatternConverter.php        |   3 +-
 .../helpers/LoggerPatternParser.php           |  12 +-
 .../layouts/LoggerLayoutHtml.php              |  21 +-
 .../layouts/LoggerLayoutPattern.php           |  30 +-
 .../layouts/LoggerLayoutSerialized.php        |  55 ++
 .../layouts/LoggerLayoutSimple.php            |   8 +-
 .../layouts/LoggerLayoutTTCC.php              |  16 +-
 .../log4php.debug/layouts/LoggerLayoutXml.php | 136 +++--
 .../renderers/LoggerRendererMap.php           |   3 +-
 49 files changed, 2405 insertions(+), 2500 deletions(-)
 create mode 100644 libraries/log4php.debug/LoggerConfigurable.php
 delete mode 100644 libraries/log4php.debug/appenders/LoggerAppenderAdodb.php
 rename libraries/log4php.debug/configurators/{LoggerConfiguratorBasic.php => LoggerConfigurationAdapter.php} (53%)
 create mode 100644 libraries/log4php.debug/configurators/LoggerConfigurationAdapterINI.php
 create mode 100644 libraries/log4php.debug/configurators/LoggerConfigurationAdapterPHP.php
 create mode 100644 libraries/log4php.debug/configurators/LoggerConfigurationAdapterXML.php
 create mode 100644 libraries/log4php.debug/configurators/LoggerConfiguratorDefault.php
 delete mode 100644 libraries/log4php.debug/configurators/LoggerConfiguratorIni.php
 delete mode 100644 libraries/log4php.debug/configurators/LoggerConfiguratorPhp.php
 delete mode 100644 libraries/log4php.debug/configurators/LoggerConfiguratorXml.php
 create mode 100644 libraries/log4php.debug/layouts/LoggerLayoutSerialized.php

diff --git a/libraries/log4php.debug/Logger.php b/libraries/log4php.debug/Logger.php
index 3e2eaf9ca..447fd7919 100644
--- a/libraries/log4php.debug/Logger.php
+++ b/libraries/log4php.debug/Logger.php
@@ -38,10 +38,9 @@ spl_autoload_register(array('Logger', 'autoload'));
  * 		<li>{@link fatal()}</li>
  * 	</ul>
  * 
- * @category   log4php
  * @package    log4php
  * @license	   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version	   SVN: $Id: Logger.php 1137439 2011-06-19 21:13:04Z ihabunek $
+ * @version	   SVN: $Id: Logger.php 1213710 2011-12-13 14:30:50Z ihabunek $
  * @link	   http://logging.apache.org/log4php
  */
 class Logger {
@@ -53,15 +52,16 @@ class Logger {
 		'LoggerMDC' => '/LoggerMDC.php',
 		'LoggerNDC' => '/LoggerNDC.php',
 		'LoggerReflectionUtils' => '/LoggerReflectionUtils.php',
+		'LoggerConfigurable' => '/LoggerConfigurable.php',
 		'LoggerConfigurator' => '/LoggerConfigurator.php',
-		'LoggerConfiguratorBasic' => '/configurators/LoggerConfiguratorBasic.php',
-		'LoggerConfiguratorIni' => '/configurators/LoggerConfiguratorIni.php',
-		'LoggerConfiguratorPhp' => '/configurators/LoggerConfiguratorPhp.php',
-		'LoggerConfiguratorXml' => '/configurators/LoggerConfiguratorXml.php',
+		'LoggerConfiguratorDefault' => '/configurators/LoggerConfiguratorDefault.php',
+		'LoggerConfigurationAdapter' => '/configurators/LoggerConfigurationAdapter.php',
+		'LoggerConfigurationAdapterINI' => '/configurators/LoggerConfigurationAdapterINI.php',
+		'LoggerConfigurationAdapterXML' => '/configurators/LoggerConfigurationAdapterXML.php',
+		'LoggerConfigurationAdapterPHP' => '/configurators/LoggerConfigurationAdapterPHP.php',
 		'LoggerRoot' => '/LoggerRoot.php',
 		'LoggerAppender' => '/LoggerAppender.php',
 		'LoggerAppenderPool' => '/LoggerAppenderPool.php',
-		'LoggerAppenderAdodb' => '/appenders/LoggerAppenderAdodb.php',
 		'LoggerAppenderPDO' => '/appenders/LoggerAppenderPDO.php',
 		'LoggerAppenderConsole' => '/appenders/LoggerAppenderConsole.php',
 		'LoggerAppenderDailyFile' => '/appenders/LoggerAppenderDailyFile.php',
@@ -95,11 +95,11 @@ class Logger {
 		'LoggerClassNamePatternConverter' => '/helpers/LoggerClassNamePatternConverter.php',
 		'LoggerCategoryPatternConverter' => '/helpers/LoggerCategoryPatternConverter.php',
 		'LoggerPatternParser' => '/helpers/LoggerPatternParser.php',
-		'LoggerLayoutBson' => '/layouts/LoggerLayoutBson.php',
 		'LoggerLayoutHtml' => '/layouts/LoggerLayoutHtml.php',
 		'LoggerLayoutSimple' => '/layouts/LoggerLayoutSimple.php',
 		'LoggerLayoutTTCC' => '/layouts/LoggerLayoutTTCC.php',
 		'LoggerLayoutPattern' => '/layouts/LoggerLayoutPattern.php',
+		'LoggerLayoutSerialized' => '/layouts/LoggerLayoutSerialized.php',
 		'LoggerLayoutXml' => '/layouts/LoggerLayoutXml.php',
 		'LoggerRendererDefault' => '/renderers/LoggerRendererDefault.php',
 		'LoggerRendererObject' => '/renderers/LoggerRendererObject.php',
@@ -155,16 +155,10 @@ class Logger {
 	private static $hierarchy;
 	
 	/** 
-	 * Name of the configurator class used to configure log4php. 
-	 * Populated by {@link configure()} and used in {@link initialize()}.
+	 * Holds the configurator. 
+	 * @var LoggerConfigurator 
 	 */
-	private static $configurationClass = 'LoggerConfiguratorBasic';
-	
-	/** 
-	 * Path to the configuration file which may be used by the configurator.
-	 * Populated by {@link configure()} and used in {@link initialize()}. 
-	 */
-	private static $configurationFile;
+	private static $configurator;
 	
 	/** Inidicates if log4php has been initialized */
 	private static $initialized = false;
@@ -214,20 +208,22 @@ class Logger {
 	 * Log a message object with the TRACE level.
 	 *
 	 * @param mixed $message message
-	 * @param mixed $caller caller object or caller string id
+ 	 * @param Exception $throwable Optional throwable information to include 
+	 *   in the logging event.
 	 */
-	public function trace($message, $caller = null) {
-		$this->log(LoggerLevel::getLevelTrace(), $message, $caller);
+	public function trace($message, $throwable = null) {
+		$this->log(LoggerLevel::getLevelTrace(), $message, $throwable);
 	} 		
 	
 	/**
 	 * Log a message object with the DEBUG level.
 	 *
 	 * @param mixed $message message
-	 * @param mixed $caller caller object or caller string id
+ 	 * @param Exception $throwable Optional throwable information to include 
+	 *   in the logging event.
 	 */
-	public function debug($message, $caller = null) {
-		$this->log(LoggerLevel::getLevelDebug(), $message, $caller);
+	public function debug($message, $throwable = null) {
+		$this->log(LoggerLevel::getLevelDebug(), $message, $throwable);
 	} 
 
 
@@ -235,40 +231,44 @@ class Logger {
 	 * Log a message object with the INFO Level.
 	 *
 	 * @param mixed $message message
-	 * @param mixed $caller caller object or caller string id
+ 	 * @param Exception $throwable Optional throwable information to include 
+	 *   in the logging event.
 	 */
-	public function info($message, $caller = null) {
-		$this->log(LoggerLevel::getLevelInfo(), $message, $caller);
+	public function info($message, $throwable = null) {
+		$this->log(LoggerLevel::getLevelInfo(), $message, $throwable);
 	}
 
 	/**
 	 * Log a message with the WARN level.
 	 *
 	 * @param mixed $message message
-	 * @param mixed $caller caller object or caller string id
+  	 * @param Exception $throwable Optional throwable information to include 
+	 *   in the logging event.
 	 */
-	public function warn($message, $caller = null) {
-		$this->log(LoggerLevel::getLevelWarn(), $message, $caller);
+	public function warn($message, $throwable = null) {
+		$this->log(LoggerLevel::getLevelWarn(), $message, $throwable);
 	}
 	
 	/**
 	 * Log a message object with the ERROR level.
 	 *
 	 * @param mixed $message message
-	 * @param mixed $caller caller object or caller string id
+	 * @param Exception $throwable Optional throwable information to include 
+	 *   in the logging event.
 	 */
-	public function error($message, $caller = null) {
-		$this->log(LoggerLevel::getLevelError(), $message, $caller);
+	public function error($message, $throwable = null) {
+		$this->log(LoggerLevel::getLevelError(), $message, $throwable);
 	}
 	
 	/**
 	 * Log a message object with the FATAL level.
 	 *
 	 * @param mixed $message message
-	 * @param mixed $caller caller object or caller string id
+	 * @param Exception $throwable Optional throwable information to include 
+	 *   in the logging event.
 	 */
-	public function fatal($message, $caller = null) {
-		$this->log(LoggerLevel::getLevelFatal(), $message, $caller);
+	public function fatal($message, $throwable = null) {
+		$this->log(LoggerLevel::getLevelFatal(), $message, $throwable);
 	}
 	
 	/**
@@ -280,12 +280,13 @@ class Logger {
 	 * wrappers.
 	 *
 	 * @param string $fqcn Fully qualified class name of the Logger
-	 * @param mixed $caller caller object or caller string id
+	 * @param Exception $throwable Optional throwable information to include 
+	 *   in the logging event.
 	 * @param LoggerLevel $level log level	   
 	 * @param mixed $message message to log
 	 */
-	public function forcedLog($fqcn, $caller, $level, $message) {
-		$throwable = ($caller !== null && $caller instanceof Exception) ? $caller : null;
+	public function forcedLog($fqcn, $throwable, LoggerLevel $level, $message) {
+		$throwable = ($throwable !== null && $throwable instanceof Exception) ? $throwable : null;
 		
 		$this->callAppenders(new LoggerLoggingEvent($fqcn, $this, $level, $message, null, $throwable));
 	} 
@@ -305,7 +306,7 @@ class Logger {
 	 * @param LoggerLevel level
 	 * @return boolean
 	 */
-	public function isEnabledFor($level) {
+	public function isEnabledFor(LoggerLevel $level) {
 		return (bool)($level->isGreaterOrEqual($this->getEffectiveLevel()));
 	} 
 
@@ -320,13 +321,14 @@ class Logger {
 	/**
 	 * Log a message using the provided logging level.
 	 *
-	 * @param LoggerLevel $priority The logging level.
+	 * @param LoggerLevel $level The logging level.
 	 * @param mixed $message Message to log.
-	 * @param mixed $caller caller object or caller string id
+ 	 * @param Exception $throwable Optional throwable information to include 
+	 *   in the logging event.
 	 */
-	public function log($priority, $message, $caller = null) {
-		if($this->isEnabledFor($priority)) {
-			$this->forcedLog($this->fqcn, $caller, $priority, $message);
+	public function log(LoggerLevel $level, $message, $throwable = null) {
+		if($this->isEnabledFor($level)) {
+			$this->forcedLog($this->fqcn, $throwable, $level, $message);
 		}
 	}
 	
@@ -345,28 +347,27 @@ class Logger {
 	/* Factory methods */ 
 	
 	/**
-	 * Get a Logger by name (Delegate to {@link Logger})
+	 * Returns a Logger by name. 
+	 * 
+	 * If it does not exist, it will be created.
 	 * 
 	 * @param string $name logger name
-	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
 	 * @return Logger
-	 * @static 
 	 */
 	public static function getLogger($name) {
 		if(!self::isInitialized()) {
-			self::initialize();
+			self::configure();
 		}
 		return self::getHierarchy()->getLogger($name);
 	}
 	
 	/**
-	 * Get the Root Logger (Delegate to {@link Logger})
+	 * Returns the Root Logger.
 	 * @return LoggerRoot
-	 * @static 
 	 */	   
 	public static function getRootLogger() {
 		if(!self::isInitialized()) {
-			self::initialize();
+			self::configure();
 		}
 		return self::getHierarchy()->getRootLogger();	  
 	}
@@ -387,10 +388,8 @@ class Logger {
 	 * Remove all previously added appenders from the Logger.
 	 */
 	public function removeAllAppenders() {
-		$appenderNames = array_keys($this->appenders);
-		$enumAppenders = count($appenderNames);
-		for($i = 0; $i < $enumAppenders; $i++) {
-			$this->removeAppender($appenderNames[$i]); 
+		foreach($this->appenders as $name => $appender) {
+			$this->removeAppender($name);
 		}
 	} 
 			
@@ -482,8 +481,6 @@ class Logger {
 	
 	/**
 	 * Clears all Logger definitions from the logger hierarchy.
-	 * 
-	 * @static
 	 * @return boolean 
 	 */
 	public static function clear() {
@@ -492,24 +489,17 @@ class Logger {
 	
 	/**
 	 * Destroy configurations for logger definitions
-	 * 
-	 * @static
-	 * @return boolean 
 	 */
 	public static function resetConfiguration() {
-		$result = self::getHierarchy()->resetConfiguration();
+		self::getHierarchy()->resetConfiguration();
+		self::getHierarchy()->clear(); // TODO: clear or not?
 		self::$initialized = false;
-		self::$configurationClass = 'LoggerConfiguratorBasic';
-		self::$configurationFile = null;
-		return $result;	 
 	}
 
 	/**
 	 * Safely close all appenders.
-	 * 
 	 * @deprecated This is no longer necessary due the appenders shutdown via
 	 * destructors.
-	 * @static
 	 */
 	public static function shutdown() {
 		return self::getHierarchy()->shutdown();	   
@@ -519,7 +509,6 @@ class Logger {
 	 * check if a given logger exists.
 	 * 
 	 * @param string $name logger name 
-	 * @static
 	 * @return boolean
 	 */
 	public static function exists($name) {
@@ -528,8 +517,6 @@ class Logger {
 	
 	/**
 	 * Returns an array this whole Logger instances.
-	 * 
-	 * @static
 	 * @see Logger
 	 * @return array
 	 */
@@ -564,58 +551,51 @@ class Logger {
 	} 
 	
 	/**
-	 * Configures log4php by defining a configuration file and/or class.
+	 * Configures log4php.
 	 * 
 	 * This method needs to be called before the first logging event has 
-	 * occured. If this method is not called before then, the standard 
-	 * configuration takes place (@see LoggerConfiguratorBasic).
-	 * 
-	 * If only the configuration file is given, the configurator class will
-	 * be determined by the config file extension.  
-	 * 
-	 * If a custom configurator class is provided, the configuration file
-	 * should either be null or contain the path to file used by the custom 
-	 * configurator. Make sure the configurator class is already loaded, or
-	 * that it can be included by PHP when necessary.
+	 * occured. If this method is not called before then the default
+	 * configuration will be used.
+	 *
+	 * @param string|array $configuration Either a path to the configuration
+	 *   file, or a configuration array.
+	 *   
+	 * @param mixed $configuratorClass A custom configurator class: either a 
+	 * class name (string), or an object which implements LoggerConfigurator
+	 * interface. If left empty, the default configurator will be used. 
+	 */
+	public static function configure($configuration = null, $configuratorClass = null) {
+		self::resetConfiguration();
+		$configurator = self::getConfigurator($configuratorClass);
+		$configurator->configure(self::getHierarchy(), $configuration);
+		self::$initialized = true;
+	}
+	
+	/**
+	 * Creates a logger configurator instance based on the provided 
+	 * configurator class. If no class is given, returns an instance of
+	 * the default configurator.
 	 * 
-	 * @param string $configurationFile path to the configuration file
-	 * @param string $configurationClass name of the custom configurator class 
+	 * @param string $configuratorClass The configurator class.
 	 */
-	public static function configure($configurationFile = null, $configurationClass = null ) {
-		if($configurationClass === null && $configurationFile === null) {
-			self::$configurationClass = 'LoggerConfiguratorBasic';
-			return;
+	private static function getConfigurator($configuratorClass = null) {
+		if (empty($configuratorClass)) {
+			return new LoggerConfiguratorDefault();
 		}
-									 	
-		if($configurationClass !== null) {
-			self::$configurationFile = $configurationFile;
-			self::$configurationClass = $configurationClass;
-			return;
+		
+		if (!class_exists($configuratorClass)) {
+			$this->warn("Specified configurator class [$configuratorClass] does not exist. Reverting to default configurator.");
+			return new LoggerConfiguratorDefault();
 		}
 		
-		if (strtolower(substr( $configurationFile, -4 )) == '.xml') {
-			self::$configurationFile = $configurationFile;
-			self::$configurationClass = 'LoggerConfiguratorXml';
-		} else {
-			self::$configurationFile = $configurationFile;
-			self::$configurationClass = 'LoggerConfiguratorIni';
+		$configurator = new $configuratorClass();
+			
+		if (!($configurator instanceof LoggerConfigurator)) {
+			$this->warn("Specified configurator class [$configuratorClass] does not implement the LoggerConfigurator interface. Reverting to default configurator.");
+			return new LoggerConfiguratorDefault();
 		}
-	}
-	
-	/**
-	 * Returns the current {@link Logger::$configurationClass configurator class}.
-	 * @return string the configurator class name
-	 */
-	public static function getConfigurationClass() {
-		return self::$configurationClass;
-	}
-	
-	/**
-	 * Returns the current {@link Logger::$configurationFile configuration file}.
-	 * @return string the configuration file
-	 */
-	public static function getConfigurationFile() {
-		return self::$configurationFile;
+		
+		return $configurator;
 	}
 	
 	/**
@@ -626,16 +606,4 @@ class Logger {
 		return self::$initialized;
 	}
 	
-	/**
-	 * Initializes the log4php framework using the provided {@link 
-	 * Logger::$configurationClass configuration class}  and {@link 
-	 * Logger::$configurationFile configuration file}.
-	 * @return boolean
-	 */
-	public static function initialize() {
-		self::$initialized = true;
-		$instance = LoggerReflectionUtils::createObject(self::$configurationClass);
-		$result = $instance->configure(self::getHierarchy(), self::$configurationFile);
-		return $result;
-	}
 }
diff --git a/libraries/log4php.debug/LoggerAppender.php b/libraries/log4php.debug/LoggerAppender.php
index 5ab7a8d99..7498981a8 100644
--- a/libraries/log4php.debug/LoggerAppender.php
+++ b/libraries/log4php.debug/LoggerAppender.php
@@ -21,76 +21,102 @@
 /**
  * Abstract class that defines output logs strategies.
  *
- * @version $Revision: 1062665 $
+ * @version $Revision: 1213712 $
  * @package log4php
  */
-abstract class LoggerAppender {
+abstract class LoggerAppender extends LoggerConfigurable {
 	
 	/**
-	 * @var boolean closed appender flag
+	 * Set to true when the appender is closed. A closed appender will not 
+	 * accept any logging requests. 
+	 * @var boolean 
 	 */
 	protected $closed = false;
 	
 	/**
-	 * The first filter in the filter chain
+	 * The first filter in the filter chain.
 	 * @var LoggerFilter
 	 */
-	protected $filter = null;
+	protected $filter;
 			
 	/**
-	 * LoggerLayout for this appender. It can be null if appender has its own layout
+	 * The appender's layout. Can be null if the appender does not use 
+	 * a layout.
 	 * @var LoggerLayout
 	 */
-	protected $layout = null; 
+	protected $layout; 
 	
 	/**
-	 * @var string Appender name
+	 * Appender name. Used by other components to identify this appender.
+	 * @var string
 	 */
 	protected $name;
 	
 	/**
-	 * @var LoggerLevel There is no level threshold filtering by default.
+	 * Appender threshold level. Events whose level is below the threshold 
+	 * will not be logged.
+	 * @var LoggerLevel
 	 */
-	protected $threshold = null;
+	protected $threshold;
 	
 	/**
-	 * @var boolean needs a layout formatting ?
+	 * Set to true if the appender requires a layout.
+	 * 
+	 * True by default, appenders which do not use a layout should override 
+	 * this property to false.
+	 * 
+	 * @var boolean
 	 */
 	protected $requiresLayout = true;
 	
 	/**
-	 * Constructor
-	 *
-	 * @param string $name appender name
+	 * Default constructor.
+	 * @param string $name Appender name
 	 */
 	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();
+		}
 	}
-
+	
 	/**
-	 * Add a filter to the end of the filter list.
-	 *
-	 * @param LoggerFilter $newFilter add a new LoggerFilter
+	 * Returns the default layout for this appender. Can be overriden by 
+	 * derived appenders.
+	 * 
+	 * @return LoggerLayout
 	 */
-	public function addFilter($newFilter) {
+	public function getDefaultLayout()
+	{
+		return new LoggerLayoutSimple();
+	}
+	
+	/**
+	 * Adds a filter to the end of the filter chain.
+	 * @param LoggerFilter $filter add a new LoggerFilter
+	 */
+	public function addFilter($filter) {
 		if($this->filter === null) {
-			$this->filter = $newFilter;
+			$this->filter = $filter;
 		} else {
-			$this->filter->addNext($newFilter);
+			$this->filter->addNext($filter);
 		}
 	}
 	
 	/**
-	 * Clear the list of filters by removing all the filters in it.
-	 * @abstract
+	 * Clears the filter chain by removing all the filters in it.
 	 */
 	public function clearFilters() {
-		unset($this->filter);
 		$this->filter = null;
 	}
 
 	/**
-	 * Return the first filter in the filter chain for this Appender. 
+	 * Returns the first filter in the filter chain. 
 	 * The return value may be <i>null</i> if no is filter is set.
 	 * @return LoggerFilter
 	 */
@@ -99,7 +125,7 @@ abstract class LoggerAppender {
 	} 
 	
 	/** 
-	 * Return the first filter in the filter chain for this Appender. 
+	 * Returns the first filter in the filter chain. 
 	 * The return value may be <i>null</i> if no is filter is set.
 	 * @return LoggerFilter
 	 */
@@ -107,11 +133,10 @@ abstract class LoggerAppender {
 		return $this->filter;
 	}
 	
-	
 	/**
-	 * This method performs threshold checks and invokes filters before
-	 * delegating actual logging to the subclasses specific <i>append()</i> method.
-	 * @see LoggerAppender::doAppend()
+	 * Performs threshold checks and invokes filters before delegating logging 
+	 * to the subclass' specific <i>append()</i> method.
+	 * @see LoggerAppender::append()
 	 * @param LoggerLoggingEvent $event
 	 */
 	public function doAppend(LoggerLoggingEvent $event) {
@@ -135,8 +160,7 @@ abstract class LoggerAppender {
 	}	 
 
 	/**
-	 * Set the Layout for this appender.
-	 * @see LoggerAppender::setLayout()
+	 * Sets the appender layout.
 	 * @param LoggerLayout $layout
 	 */
 	public function setLayout($layout) {
@@ -146,8 +170,7 @@ abstract class LoggerAppender {
 	} 
 	
 	/**
-	 * Returns this appender layout.
-	 * @see LoggerAppender::getLayout()
+	 * Returns the appender layout.
 	 * @return LoggerLayout
 	 */
 	public function getLayout() {
@@ -169,7 +192,6 @@ abstract class LoggerAppender {
 	 * implementation admits a layout but can also work without it, then
 	 * the appender should return <i>true</i>.</p>
 	 * 
-	 * @see LoggerAppender::requiresLayout()
 	 * @return boolean
 	 */
 	public function requiresLayout() {
@@ -177,20 +199,15 @@ abstract class LoggerAppender {
 	}
 	
 	/**
-	 * Get the name of this appender.
-	 * @see LoggerAppender::getName()
+	 * Retruns the appender name.
 	 * @return string
 	 */
 	public function getName() {
 		return $this->name;
 	}
 	
-/**
-	 * Set the name of this appender.
-	 *
-	 * The name is used by other components to identify this appender.
-	 *
-	 * 
+	/**
+	 * Sets the appender name.
 	 * @param string $name
 	 */
 	public function setName($name) {
@@ -198,8 +215,7 @@ abstract class LoggerAppender {
 	}
 	
 	/**
-	 * Returns this appenders threshold level. 
-	 * See the {@link setThreshold()} method for the meaning of this option.
+	 * Returns the appender's threshold level. 
 	 * @return LoggerLevel
 	 */
 	public function getThreshold() { 
@@ -207,26 +223,24 @@ abstract class LoggerAppender {
 	}
 	
 	/**
-	 * Set the threshold level of this appender.
-	 *
-	 * @param mixed $threshold can be a {@link LoggerLevel} object or a string.
+	 * Sets the appender threshold.
+	 * 
+	 * @param LoggerLevel|string $threshold Either a {@link LoggerLevel} 
+	 *   object or a string equivalent.
 	 * @see LoggerOptionConverter::toLevel()
 	 */
 	public function setThreshold($threshold) {
-		if(is_string($threshold)) {
-			$this->threshold = LoggerOptionConverter::toLevel($threshold, null);
-		} else if($threshold instanceof LoggerLevel) {
-			$this->threshold = $threshold;
-		}
+		$this->setLevel('threshold', $threshold);
 	}
 	
 	/**
-	 * Check whether the message level is below the appender's threshold. 
-	 *
+	 * Checks whether the message level is below the appender's threshold. 
 	 *
 	 * If there is no threshold set, then the return value is always <i>true</i>.
+	 * 
 	 * @param LoggerLevel $level
-	 * @return boolean true if priority is greater or equal than threshold	
+	 * @return boolean Returns true if level is greater or equal than 
+	 *   threshold, or if the threshold is not set. Otherwise returns false.
 	 */
 	public function isAsSevereAsThreshold($level) {
 		if($this->threshold === null) {
@@ -236,26 +250,38 @@ abstract class LoggerAppender {
 	}
 
 	/**
+	 * Prepares the appender for logging.
+	 * 
 	 * Derived appenders should override this method if option structure
 	 * requires it.
 	 */
-	abstract public function activateOptions();
+	public function activateOptions() {
+		$this->closed = false;
+	}
 	
 	/**
-	 * Subclasses of {@link LoggerAppender} should implement 
-	 * this method to perform actual logging.
-	 *
+	 * Forwards the logging event to the destination.
+	 * 
+	 * Derived appenders should implement this method to perform actual logging.
+	 * 
 	 * @param LoggerLoggingEvent $event
-	 * @see doAppend()
-	 * @abstract
 	 */
 	abstract protected function append(LoggerLoggingEvent $event); 
 
 	/**
-	 * Release any resources allocated.
-	 * Subclasses of {@link LoggerAppender} should implement 
-	 * this method to perform proper closing procedures.
-	 * @abstract
+	 * Releases any resources allocated by the appender.
+	 * 
+	 * Derived appenders should override this method to perform proper closing
+	 * procedures.
 	 */
-	abstract public function close();
+	public function close() {
+		$this->closed = true;
+	}
+	
+	/** Triggers a warning for this logger with the given message. */
+	protected function warn($message) {
+		$id = get_class($this) . (empty($this->name) ? '' : ":{$this->name}");
+		trigger_error("log4php: [$id]: $message", E_USER_WARNING);
+	}
+	
 }
diff --git a/libraries/log4php.debug/LoggerAppenderPool.php b/libraries/log4php.debug/LoggerAppenderPool.php
index 99e3e561b..a2266f951 100644
--- a/libraries/log4php.debug/LoggerAppenderPool.php
+++ b/libraries/log4php.debug/LoggerAppenderPool.php
@@ -19,42 +19,81 @@
  */
 
 /**
- * Pool implmentation for LoggerAppender instances
+ * Pool implmentation for LoggerAppender instances.
+ * 
+ * The pool is used when configuring log4php. First all appender instances 
+ * are created in the pool. Afterward, they are linked to loggers, each 
+ * appender can be linked to multiple loggers. This makes sure duplicate 
+ * appenders are not created.
  *
  * @version $Revision: 795727 $
  * @package log4php
  */
 class LoggerAppenderPool {
-	/* Appender Pool */
-	public static $appenderPool =  array();
 	
+	/** Holds appenders indexed by their name */
+	public static $appenders =  array();
+
 	/**
-	 * 
-	 *
-	 * @param string $name 
-	 * @param string $class 
-	 * @return LoggerAppender
+	 * Adds an appender to the pool. 
+	 * The appender must be named for this operation. 
+	 * @param LoggerAppender $appender
 	 */
-	public static function getAppenderFromPool($name, $class = '') {
-		if(isset(self::$appenderPool[$name])) {
-			return self::$appenderPool[$name];
-		}
+	public static function add(LoggerAppender $appender)
+	{
+		$name = $appender->getName();
 		
-		if(empty($class)) {
-			return null;
+		if(empty($name)) {
+			trigger_error('log4php: Cannot add unnamed appender to pool.', E_USER_WARNING);
+			return;
 		}
 		
-		$appender = LoggerReflectionUtils::createObject($class);
-		$appender->setName($name);
-		if($appender !== null) { 
-			self::$appenderPool[$name] = $appender;
-			return self::$appenderPool[$name];
+		if (isset(self::$appenders[$name])) {
+			trigger_error("log4php: Appender [$name] already exists in pool. Overwriting existing appender.", E_USER_WARNING);
 		}
-		return null;		
+		
+		self::$appenders[$name] = $appender;
 	}
 	
-	public static function clear()
-	{
-		 self::$appenderPool =  array();
+	/** 
+	 * Retrieves an appender from the pool by name. 
+	 * @param string $name Name of the appender to retrieve.
+	 * @return LoggerAppender The named appender or NULL if no such appender 
+	 *  exists in the pool.
+	 */
+	public static function get($name) {
+		return isset(self::$appenders[$name]) ? self::$appenders[$name] : null;
+	}
+	
+	/**
+	* Removes an appender from the pool by name.
+	* @param string $name Name of the appender to remove.
+	*/
+	public static function delete($name) {
+		unset(self::$appenders[$name]);
+	}
+	
+	/**
+	 * Returns all appenders from the pool.
+	 * @return array Array of LoggerAppender objects.
+	 */
+	public static function getAppenders() {
+		return self::$appenders;
+	}
+	
+	/**
+	 * Checks whether an appender exists in the pool.
+	 * @param string $name Name of the appender to look for.
+	 * @return boolean TRUE if the appender with the given name exists.
+	 */
+	public static function exists($name) {
+		return isset(self::$appenders[$name]);
+	}
+
+	/**
+	 * Clears all appenders from the pool.
+	 */
+	public static function clear() {
+		 self::$appenders =  array();
 	}
 }
diff --git a/libraries/log4php.debug/LoggerConfigurable.php b/libraries/log4php.debug/LoggerConfigurable.php
new file mode 100644
index 000000000..7f54e6fa4
--- /dev/null
+++ b/libraries/log4php.debug/LoggerConfigurable.php
@@ -0,0 +1,119 @@
+<?php
+/**
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (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
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* @package log4php
+*/
+
+/** 
+ * A base class from which all classes which have configurable properties are 
+ * extended. Provides a generic setter with integrated validation.  
+ * 
+ * @package log4php
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version $Revision $
+ * @since 2.2
+ */
+abstract class LoggerConfigurable {
+	
+	/** Setter function for boolean type. */
+	protected function setBoolean($property, $value) {
+		try {
+			$this->$property = LoggerOptionConverter::toBooleanEx($value);
+		} catch (Exception $ex) {
+			$value = var_export($value, true);
+			$this->warn("Invalid value given for '$property' property: [$value]. Expected a boolean value. Property not changed.");
+		}
+	}
+	
+	/** Setter function for integer type. */
+	protected function setInteger($property, $value) {
+		try {
+			$this->$property = LoggerOptionConverter::toIntegerEx($value);
+		} catch (Exception $ex) {
+			$value = var_export($value, true);
+			$this->warn("Invalid value given for '$property' property: [$value]. Expected an integer. Property not changed.");
+		}
+	}
+	
+	/** Setter function for LoggerLevel values. */
+	protected function setLevel($property, $value) {
+		try {
+			$this->$property = LoggerOptionConverter::toLevelEx($value);
+		} catch (Exception $ex) {
+			$value = var_export($value, true);
+			$this->warn("Invalid value given for '$property' property: [$value]. Expected a level value. Property not changed.");
+		}
+	}
+	
+	/** Setter function for integer type. */
+	protected function setPositiveInteger($property, $value) {
+		try {
+			$this->$property = LoggerOptionConverter::toPositiveIntegerEx($value);
+		} catch (Exception $ex) {
+			$value = var_export($value, true);
+			$this->warn("Invalid value given for '$property' property: [$value]. Expected a positive integer. Property not changed.");
+		}
+	}
+	
+	/** Setter for file size. */
+	protected function setFileSize($property, $value) {
+		try {
+			$this->$property = LoggerOptionConverter::toFileSizeEx($value);
+		} catch (Exception $ex) {
+			$value = var_export($value, true);
+			$this->warn("Invalid value given for '$property' property: [$value]. Expected a file size value.  Property not changed.");
+		}
+	}
+	
+	/** Setter function for numeric type. */
+	protected function setNumeric($property, $value) {
+		try {
+			$this->$property = LoggerOptionConverter::toNumericEx($value);
+		} catch (Exception $ex) {
+			$value = var_export($value, true);
+			$this->warn("Invalid value given for '$property' property: [$value]. Expected a number. Property not changed.");
+		}
+	}
+	
+	/** Setter function for string type. */
+	protected function setString($property, $value, $nullable = false) {
+		if ($value === null) {
+			if($nullable) {
+				$this->$property= null;
+			} else {
+				$this->warn("Null value given for '$property' property. Expected a string. Property not changed.");
+			}
+		} else {
+			try {
+				$this->$property = LoggerOptionConverter::toStringEx($value);
+			} catch (Exception $ex) {
+				$value = var_export($value, true);
+				$this->warn("Invalid value given for '$property' property: [$value]. Expected a string. Property not changed.");
+			}
+		}
+	}
+	
+	/** Triggers a warning. */
+	protected function warn($message) {
+		$class = get_class($this);
+		trigger_error("log4php: $class: $message", E_USER_WARNING);
+	}
+}
+
+
+
+?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/LoggerConfigurator.php b/libraries/log4php.debug/LoggerConfigurator.php
index 192c87a99..8d6860e71 100644
--- a/libraries/log4php.debug/LoggerConfigurator.php
+++ b/libraries/log4php.debug/LoggerConfigurator.php
@@ -19,35 +19,24 @@
  */
 
 /**
- * Implemented by classes capable of configuring log4php using a URL.
- *	
- * @version $Revision: 822448 $
+ * Interface for logger configurators.
+ * 
  * @package log4php
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version $Revision: 1213710 $
+ * @since 2.2
  */
-interface LoggerConfigurator {
-	
+interface LoggerConfigurator
+{
 	/**
-	 * Special level value signifying inherited behaviour. The current
-	 * value of this string constant is <b>inherited</b>. 
-	 * {@link CONFIGURATOR_NULL} is a synonym.  
+	 * Configures log4php based on the given configuration. 
+	 * 
+	 * All configurators implementations must implement this interface.
+	 * 
+	 * @param LoggerHierarchy $hierarchy The hierarchy on which to perform 
+	 * 		the configuration. 
+	 * @param mixed $input Either path to the config file or the 
+	 * 		configuration as an array.
 	 */
-	const CONFIGURATOR_INHERITED = 'inherited';
-	
-	/**
-	 * Special level signifying inherited behaviour, same as 
-	 * {@link CONFIGURATOR_INHERITED}. 
-	 * The current value of this string constant is <b>null</b>. 
-	 */
-	const CONFIGURATOR_NULL = 'null';
-		
-	/**
-	 * Interpret a resource pointed by a <var>url</var> and configure accordingly.
-	 *
-	 * The configuration is done relative to the <var>repository</var>
-	 * parameter.
-	 *
-	 * @param string $url The URL to parse
-	 */
-	public function configure(LoggerHierarchy $hierarchy, $url = null);
-	
+	public function configure(LoggerHierarchy $hierarchy, $input = null);
 }
diff --git a/libraries/log4php.debug/LoggerFilter.php b/libraries/log4php.debug/LoggerFilter.php
index 33ac99df9..27a76b84e 100644
--- a/libraries/log4php.debug/LoggerFilter.php
+++ b/libraries/log4php.debug/LoggerFilter.php
@@ -50,10 +50,10 @@
  * <p>The philosophy of log4php filters is largely inspired from the
  * Linux ipchains. 
  * 
- * @version $Revision: 1059292 $
+ * @version $Revision: 1213283 $
  * @package log4php
  */
-abstract class LoggerFilter {
+abstract class LoggerFilter extends LoggerConfigurable {
 
 	/**
 	 * The log event must be logged immediately without consulting with
diff --git a/libraries/log4php.debug/LoggerHierarchy.php b/libraries/log4php.debug/LoggerHierarchy.php
index 8cccfb58f..e7dd46d72 100644
--- a/libraries/log4php.debug/LoggerHierarchy.php
+++ b/libraries/log4php.debug/LoggerHierarchy.php
@@ -44,34 +44,36 @@
  * to the provision node. Other descendants of the same ancestor add
  * themselves to the previously created provision node.</p>
  *
- * @version $Revision: 1059292 $
+ * @version $Revision: 1163124 $
  * @package log4php
  */
- /*
-  * TODO:
-  * - addHierarchyEventListener($listener) not supported
-  * - emitNoAppenderWarning($cat) not supported
-  * - fireAddAppenderEvent not supported
-  */
 class LoggerHierarchy {
-	/** Default Factory  */
-	protected $defaultFactory;
 	
-	/** array hierarchy tree. saves here all loggers */
-	protected $ht = array();
+	/** Array holding all Logger instances. */
+	protected $loggers = array();
 	
-	/** The root Logger */
+	/** 
+	 * The root logger.
+	 * @var RootLogger 
+	 */
 	protected $root = null;
 	
-	/** LoggerRendererMap */
+	/** 
+	 * The logger renderer map.
+	 * @var LoggerRendererMap 
+	 */
 	protected $rendererMap;
 
-	/** LoggerLevel main level threshold */
+	/** 
+	 * Main level threshold. Events with lower level will not be logged by any 
+	 * logger, regardless of it's configuration.
+	 * @var LoggerLevel 
+	 */
 	protected $threshold;
 	
 	/**
-	 * Create a new logger hierarchy.
-	 * @param object $root the root logger
+	 * Creates a new logger hierarchy.
+	 * @param LoggerRoot $root The root logger.
 	 */
 	public function __construct(LoggerRoot $root) {
 		$this->root = $root;
@@ -80,10 +82,10 @@ class LoggerHierarchy {
 	}
 	 
 	/**
-	 * This call will clear all logger definitions from the internal hashtable.
+	 * Clears all loggers.
 	 */
 	public function clear() {
-		$this->ht = array();
+		$this->loggers = array();
 	}
 	
 	/**
@@ -92,38 +94,36 @@ class LoggerHierarchy {
 	 * @return boolean
 	 */
 	public function exists($name) {
-		return isset($this->ht[$name]);
+		return isset($this->loggers[$name]);
 	}
 
 	/**
-	 * Returns all the currently defined categories in this hierarchy as an array.
+	 * Returns all the currently defined loggers in this hierarchy as an array.
 	 * @return array
 	 */	 
 	public function getCurrentLoggers() {
-		return array_values($this->ht);
+		return array_values($this->loggers);
 	}
 	
 	/**
-	 * Return a new logger instance named as the first parameter using the default factory.
+	 * Returns a named logger instance logger. If it doesn't exist, one is created.
 	 * 
-	 * @param string $name logger name
-	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
-	 * @return Logger
+	 * @param string $name Logger name
+	 * @return Logger Logger instance.
 	 */
 	public function getLogger($name) {
-		if(!isset($this->ht[$name])) {
-			$this->ht[$name] = new Logger($name);;
-			// TODO: isn't necessary, access via singleton?
-			// $this->ht[$name]->setHierarchy($this);
+		if(!isset($this->loggers[$name])) {
+			$logger = new Logger($name);
+
 			$nodes = explode('.', $name);
 			$firstNode = array_shift($nodes);
 			
 			// if name is not a first node but another first node is their
-			if($firstNode != $name and isset($this->ht[$firstNode])) {
-				$this->ht[$name]->setParent($this->ht[$firstNode]);
+			if($firstNode != $name and isset($this->loggers[$firstNode])) {
+				$logger->setParent($this->loggers[$firstNode]);
 			} else {
 				// if there is no father, set root logger as father
-				$this->ht[$name]->setParent($this->root);
+				$logger->setParent($this->root);
 			} 
 		
 			// if there are more nodes than one
@@ -131,27 +131,30 @@ class LoggerHierarchy {
 				// find parent node
 				foreach($nodes as $node) {
 					$parentNode = "$firstNode.$node";
-					if(isset($this->ht[$parentNode]) and $parentNode != $name) {
-		
-						$this->ht[$name]->setParent($this->ht[$parentNode]);
+					if(isset($this->loggers[$parentNode]) and $parentNode != $name) {
+						$logger->setParent($this->loggers[$parentNode]);
 					}
 					$firstNode .= ".$node";
 				}
 			}
+			
+			$this->loggers[$name] = $logger;
 		}		
 		
-		return $this->ht[$name];
+		return $this->loggers[$name];
 	} 
 	
 	/**
-	 * @return LoggerRendererMap Get the renderer map for this hierarchy.
+	 * Returns the logger renderer map.
+	 * @return LoggerRendererMap 
 	 */
 	public function getRendererMap() {
 		return $this->rendererMap;
 	}
 	
 	/**
-	 * @return LoggerRoot Get the root of this hierarchy.
+	 * Returns the root logger.
+	 * @return LoggerRoot
 	 */ 
 	public function getRootLogger() {
 		if(!isset($this->root) or $this->root == null) {
@@ -161,15 +164,16 @@ class LoggerHierarchy {
 	}
 	 
 	/**
-	 * @return LoggerLevel Returns the threshold Level.
+	 * Returns the main threshold level.
+	 * @return LoggerLevel 
 	 */
 	public function getThreshold() {
 		return $this->threshold;
 	} 
 
 	/**
-	 * This method will return true if this repository is disabled 
-	 * for level object passed as parameter and false otherwise.
+	 * Returns true if the hierarchy is disabled for given log level and false
+	 * otherwise.
 	 * @return boolean
 	 */
 	public function isDisabled(LoggerLevel $level) {
@@ -180,13 +184,12 @@ class LoggerHierarchy {
 	 * Reset all values contained in this hierarchy instance to their
 	 * default. 
 	 *
-	 * This removes all appenders from all categories, sets
-	 * the level of all non-root categories to <i>null</i>,
+	 * This removes all appenders from all loggers, sets
+	 * the level of all non-root loggers to <i>null</i>,
 	 * sets their additivity flag to <i>true</i> and sets the level
-	 * of the root logger to {@link LOGGER_LEVEL_DEBUG}.  Moreover,
-	 * message disabling is set its default "off" value.
+	 * of the root logger to {@link LOGGER_LEVEL_DEBUG}.
 	 * 
-	 * <p>Existing categories are not removed. They are just reset.
+	 * <p>Existing loggers are not removed. They are just reset.
 	 *
 	 * <p>This method should be used sparingly and with care as it will
 	 * block all logging until it is completed.</p>
@@ -197,50 +200,41 @@ class LoggerHierarchy {
 		$root->setLevel(LoggerLevel::getLevelDebug());
 		$this->setThreshold(LoggerLevel::getLevelAll());
 		$this->shutDown();
-		$loggers = $this->getCurrentLoggers();
-		$enumLoggers = count($loggers);
-		for($i = 0; $i < $enumLoggers; $i++) {
-			$loggers[$i]->setLevel(null);
-			$loggers[$i]->setAdditivity(true);
-			$loggers[$i]->removeAllAppenders();
+		
+		foreach($this->loggers as $logger) {
+			$logger->setLevel(null);
+			$logger->setAdditivity(true);
+			$logger->removeAllAppenders();
 		}
+		
 		$this->rendererMap->clear();
 		LoggerAppenderPool::clear();
 	}
 	
 	/**
-	 * set a new threshold level
-	 *
+	 * Sets the main threshold level.
 	 * @param LoggerLevel $l
 	 */
-	public function setThreshold(LoggerLevel $l) {
-		if($l !== null) {
-			$this->threshold = $l;
-		}
+	public function setThreshold(LoggerLevel $threshold) {
+		$this->threshold = $threshold;
 	}
 	
 	/**
 	 * Shutting down a hierarchy will <i>safely</i> close and remove
-	 * all appenders in all categories including the root logger.
-	 * 
-	 * <p>Some appenders such as {@link LoggerSocketAppender}
-	 * need to be closed before the
-	 * application exists. Otherwise, pending logging events might be
-	 * lost.
+	 * all appenders in all loggers including the root logger.
 	 * 
-	 * <p>The shutdown method is careful to close nested
+	 * The shutdown method is careful to close nested
 	 * appenders before closing regular appenders. This is allows
 	 * configurations where a regular appender is attached to a logger
 	 * and again to a nested appender.
+	 * 
+	 * @todo Check if the last paragraph is correct.
 	 */
 	public function shutdown() {
 		$this->root->removeAllAppenders();
-		$cats = $this->getCurrentLoggers();
-		$enumCats = count($cats);
-		if($enumCats > 0) {
-			for($i = 0; $i < $enumCats; $i++) {
-				$cats[$i]->removeAllAppenders();
-			}
+		
+		foreach($this->loggers as $logger) {
+			$logger->removeAllAppenders();
 		}
 	}
 } 
diff --git a/libraries/log4php.debug/LoggerLayout.php b/libraries/log4php.debug/LoggerLayout.php
index 3e0e74968..81bf71b1f 100644
--- a/libraries/log4php.debug/LoggerLayout.php
+++ b/libraries/log4php.debug/LoggerLayout.php
@@ -21,11 +21,10 @@
 /**
  * Extend this abstract class to create your own log layout format.
  *	
- * @version $Revision: 822415 $
+ * @version $Revision: 1213283 $
  * @package log4php
- * @abstract
  */
-abstract class LoggerLayout {
+abstract class LoggerLayout extends LoggerConfigurable {
 	/**
 	 * Activates options for this layout.
 	 * Override this method if you have options to be activated.
@@ -67,4 +66,9 @@ abstract class LoggerLayout {
 	public function getHeader() {
 		return null;
 	}
+	
+	/** Triggers a warning for this layout with the given message. */
+	protected function warn($message) {
+		trigger_error("log4php: [" . get_class($this) . "]: $message", E_USER_WARNING);
+	}
 }
diff --git a/libraries/log4php.debug/LoggerLevel.php b/libraries/log4php.debug/LoggerLevel.php
index e2384d533..c2d24e975 100644
--- a/libraries/log4php.debug/LoggerLevel.php
+++ b/libraries/log4php.debug/LoggerLevel.php
@@ -27,7 +27,7 @@
  * <p>The <i>LoggerLevel</i> class may be subclassed to define a larger
  * level set.</p>
  *
- * @version $Revision: 1059292 $
+ * @version $Revision: 1212319 $
  * @package log4php
  * @since 0.5
  */
@@ -94,7 +94,6 @@ class LoggerLevel {
 	
 	/**
 	 * Returns an Off Level
-	 * @static
 	 * @return LoggerLevel
 	 */
 	public static function getLevelOff() {
@@ -106,7 +105,6 @@ class LoggerLevel {
 
 	/**
 	 * Returns a Fatal Level
-	 * @static
 	 * @return LoggerLevel
 	 */
 	public static function getLevelFatal() {
@@ -118,7 +116,6 @@ class LoggerLevel {
 	
 	/**
 	 * Returns an Error Level
-	 * @static
 	 * @return LoggerLevel
 	 */
 	public static function getLevelError() {
@@ -130,7 +127,6 @@ class LoggerLevel {
 	
 	/**
 	 * Returns a Warn Level
-	 * @static
 	 * @return LoggerLevel
 	 */
 	public static function getLevelWarn() {
@@ -142,7 +138,6 @@ class LoggerLevel {
 
 	/**
 	 * Returns an Info Level
-	 * @static
 	 * @return LoggerLevel
 	 */
 	public static function getLevelInfo() {
@@ -154,7 +149,6 @@ class LoggerLevel {
 
 	/**
 	 * Returns a Debug Level
-	 * @static
 	 * @return LoggerLevel
 	 */
 	public static function getLevelDebug() {
@@ -166,7 +160,6 @@ class LoggerLevel {
 	
 	/**
 	 * Returns a Trace Level
-	 * @static
 	 * @return LoggerLevel
 	 */
 	public static function getLevelTrace() {
@@ -178,7 +171,6 @@ class LoggerLevel {
 
 	/**
 	 * Returns an All Level
-	 * @static
 	 * @return LoggerLevel
 	 */
 	public static function getLevelAll() {
@@ -190,7 +182,6 @@ class LoggerLevel {
 	
 	/**
 	 * Return the syslog equivalent of this priority as an integer.
-	 * @final
 	 * @return integer
 	 */
 	public function getSyslogEquivalent() {
@@ -237,41 +228,37 @@ class LoggerLevel {
 	}
 
 	/**
-	 * Convert the string passed as argument to a level. If the
-	 * conversion fails, then this method returns a DEBUG Level.
+	 * Convert the input argument to a level. If the conversion fails, then 
+	 * this method returns the provided default level.
 	 *
-	 * @param mixed $arg
-	 * @param LoggerLevel $default
-	 * @static 
+	 * @param mixed $arg The value to convert to level.
+	 * @param LoggerLevel $default Value to return if conversion is not possible.
+	 * @return LoggerLevel 
 	 */
 	public static function toLevel($arg, $defaultLevel = null) {
-		if($defaultLevel === null) {
-			return self::toLevel($arg, self::getLevelDebug());
+		if(is_int($arg)) {
+			switch($arg) {
+				case self::ALL:	return self::getLevelAll();
+				case self::TRACE: return self::getLevelTrace();
+				case self::DEBUG: return self::getLevelDebug();
+				case self::INFO: return self::getLevelInfo();
+				case self::WARN: return self::getLevelWarn();
+				case self::ERROR: return self::getLevelError();
+				case self::FATAL: return self::getLevelFatal();
+				case self::OFF:	return self::getLevelOff();
+				default: return $defaultLevel;
+			}
 		} else {
-			if(is_int($arg)) {
-				switch($arg) {
-					case self::ALL:	return self::getLevelAll();
-					case self::TRACE: return self::getLevelTrace();
-					case self::DEBUG: return self::getLevelDebug();
-					case self::INFO: return self::getLevelInfo();
-					case self::WARN: return self::getLevelWarn();
-					case self::ERROR: return self::getLevelError();
-					case self::FATAL: return self::getLevelFatal();
-					case self::OFF:	return self::getLevelOff();
-					default: return $defaultLevel;
-				}
-			} else {
-				switch(strtoupper($arg)) {
-					case 'ALL':	return self::getLevelAll();
-					case 'TRACE': return self::getLevelTrace();
-					case 'DEBUG': return self::getLevelDebug();
-					case 'INFO': return self::getLevelInfo();
-					case 'WARN': return self::getLevelWarn();
-					case 'ERROR': return self::getLevelError();
-					case 'FATAL': return self::getLevelFatal();
-					case 'OFF':	return self::getLevelOff();
-					default: return $defaultLevel;
-				}
+			switch(strtoupper($arg)) {
+				case 'ALL':	return self::getLevelAll();
+				case 'TRACE': return self::getLevelTrace();
+				case 'DEBUG': return self::getLevelDebug();
+				case 'INFO': return self::getLevelInfo();
+				case 'WARN': return self::getLevelWarn();
+				case 'ERROR': return self::getLevelError();
+				case 'FATAL': return self::getLevelFatal();
+				case 'OFF':	return self::getLevelOff();
+				default: return $defaultLevel;
 			}
 		}
 	}
diff --git a/libraries/log4php.debug/LoggerLoggingEvent.php b/libraries/log4php.debug/LoggerLoggingEvent.php
index ccf01c955..7736a6cac 100644
--- a/libraries/log4php.debug/LoggerLoggingEvent.php
+++ b/libraries/log4php.debug/LoggerLoggingEvent.php
@@ -21,7 +21,7 @@
 /**
  * The internal representation of logging event.
  *
- * @version $Revision: 1059292 $
+ * @version $Revision: 1212773 $
  * @package log4php
  */
 class LoggerLoggingEvent {
@@ -272,6 +272,14 @@ class LoggerLoggingEvent {
 	public function getMDC($key) {
 		return LoggerMDC::get($key);
 	}
+	
+	/**
+	 * Returns the entire MDC context.
+	 * @return array
+	 */
+	public function getMDCMap () {
+		return LoggerMDC::getMap();
+	}
 
 	/**
 	 * Render message.
@@ -297,9 +305,7 @@ class LoggerLoggingEvent {
 	/**
 	 * Returns the time when the application started, in seconds
 	 * elapsed since 01.01.1970 plus microseconds if available.
-	 *
 	 * @return float
-	 * @static
 	 */
 	public static function getStartTime() {
 		if(!isset(self::$startTime)) {
diff --git a/libraries/log4php.debug/LoggerMDC.php b/libraries/log4php.debug/LoggerMDC.php
index 34f917955..9f3f3008e 100644
--- a/libraries/log4php.debug/LoggerMDC.php
+++ b/libraries/log4php.debug/LoggerMDC.php
@@ -21,17 +21,15 @@
 /**
  * The LoggerMDC class provides <i>mapped diagnostic contexts</i>.
  * 
- * <p>A <i>Mapped Diagnostic Context</i>, or
+ * A <i>Mapped Diagnostic Context</i>, or
  * MDC in short, is an instrument for distinguishing interleaved log
  * output from different sources. Log output is typically interleaved
  * when a server handles multiple clients near-simultaneously.
  * 
- * <p>This class is similar to the {@link LoggerNDC} class except that 
+ * This class is similar to the {@link LoggerNDC} class except that 
  * it is based on a map instead of a stack.
  * 
- * <p><b>The MDC is managed on a per thread basis</b>.
- * 
- * <p>Example:
+ * Example:
  * 
  * {@example ../../examples/php/mdc.php 19}<br>
  *
@@ -45,47 +43,36 @@
  * 2009-09-13 18:48:28 DEBUG root knut: Testing MDC in src/examples/php/mdc.php at 23
  * </pre>
  * 
- * @version $Revision: 998444 $
+ * @version $Revision: 1212773 $
  * @since 0.3
  * @package log4php
  */
 class LoggerMDC {
 	
-	/**
-	 * This is the repository of user mappings
-	 */
+	/** Holds the context map. */
 	private static $map = array();
 		
 	/**
-	 * Put a context value as identified with the key parameter into the current thread's
-	 *	context map.
-	 *
-	 * <p>If the current thread does not have a context map it is
-	 *	created as a side effect.</p>
-	 *
-	 * <p>Note that you cannot put more than {@link self::HT_SIZE} keys.</p>
+	 * Stores a context value as identified with the key parameter into the 
+	 * context map.
 	 *
 	 * @param string $key the key
 	 * @param string $value the value
-	 * @static
 	 */
 	public static function put($key, $value) {
 		self::$map[$key] = $value;
 	}
   
 	/**
-	 * Get the context identified by the key parameter.
-	 *
-	 * <p>You can use special key identifiers to map values in 
-	 * PHP $_SERVER and $_ENV vars. Just put a 'server.' or 'env.'
-	 * followed by the var name you want to refer.</p>
+	 * Returns the context value identified by the key parameter.
 	 *
-	 * <p>This method has no side effects.</p>
+	 * Special key identifiers can be used to map values in the global $_SERVER
+	 * and $_ENV vars. To access them, use 'server.' or 'env.' followed by the 
+	 * desired var name as the key.
 	 *
-	 * @param string $key the key
-	 * @return string the context or an empty string if no context found
-	 * 	for given key
-	 * @static
+	 * @param string $key The key.
+	 * @return string The context or an empty string if no context found
+	 * 	for given key.
 	 */
 	public static function get($key) {
 		if(!empty($key)) {
@@ -104,14 +91,28 @@ class LoggerMDC {
 	}
 
 	/**
-	 * Remove the the context identified by the key parameter. 
+	 * Returns the contex map as an array.
+	 * @return array The MDC context map.
+	 */
+	public static function getMap() {
+		return self::$map;
+	}
+
+	/**
+	 * Removes the the context identified by the key parameter. 
 	 *
-	 * It only affects user mappings, not $_ENV or $_SERVER.
+	 * Only affects user mappings, not $_ENV or $_SERVER.
 	 *
-	 * @param string $key the key to be removed
-	 * @static
+	 * @param string $key The key to be removed.
 	 */
 	public static function remove($key) {
 		unset(self::$map[$key]);
 	}
+	
+	/**
+	 * Clears the mapped diagnostic context.
+	 */
+	public static function clear() {
+		self::$map = array();
+	}
 }
diff --git a/libraries/log4php.debug/LoggerNDC.php b/libraries/log4php.debug/LoggerNDC.php
index b7283ac17..1521f3e61 100644
--- a/libraries/log4php.debug/LoggerNDC.php
+++ b/libraries/log4php.debug/LoggerNDC.php
@@ -89,7 +89,7 @@
  * 2009-09-13 19:04:27 DEBUG root : back and waiting for new connections in src/examples/php/ndc.php at 29
  * </pre>
  *	
- * @version $Revision: 998456 $
+ * @version $Revision: 1166187 $
  * @package log4php 
  * @since 0.3
  */
@@ -105,8 +105,6 @@ class LoggerNDC {
 	 *
 	 * <p>This method is equivalent to calling the {@link setMaxDepth()}
 	 * method with a zero <var>maxDepth</var> argument.
-	 *
-	 * @static
 	 */
 	public static function clear() {
 		self::$stack = array();
@@ -114,7 +112,6 @@ class LoggerNDC {
 
 	/**
 	 * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead.
-	 * @static
 	 * @return array
 	 */
 	public static function get() {
@@ -126,7 +123,6 @@ class LoggerNDC {
 	 *
 	 * @see setMaxDepth()
 	 * @return integer
-	 * @static
 	 */
 	public static function getDepth() {
 		return count(self::$stack);
@@ -140,7 +136,6 @@ class LoggerNDC {
 	 * context is available, then the empty string "" is returned.</p>
 	 *
 	 * @return string The innermost diagnostic context.
-	 * @static
 	 */
 	public static function pop() {
 		if(count(self::$stack) > 0) {
@@ -157,7 +152,6 @@ class LoggerNDC {
 	 * <p>The returned value is the value that was pushed last. If no
 	 * context is available, then the empty string "" is returned.</p>
 	 * @return string The innermost diagnostic context.
-	 * @static
 	 */
 	public static function peek(){
 		if(count(self::$stack) > 0) {
@@ -174,7 +168,6 @@ class LoggerNDC {
 	 * determined solely by the client.
 	 *	
 	 * @param string $message The new diagnostic context information.
-	 * @static	
 	 */
 	public static function push($message) {
 		array_push(self::$stack, (string)$message);
@@ -182,7 +175,6 @@ class LoggerNDC {
 
 	/**
 	 * Remove the diagnostic context for this thread.
-	 * @static
 	 */
 	public static function remove() {
 		LoggerNDC::clear();
@@ -201,7 +193,6 @@ class LoggerNDC {
 	 *
 	 * @param integer $maxDepth
 	 * @see getDepth()
-	 * @static
 	 */
 	public static function setMaxDepth($maxDepth) {
 		$maxDepth = (int)$maxDepth;
diff --git a/libraries/log4php.debug/LoggerReflectionUtils.php b/libraries/log4php.debug/LoggerReflectionUtils.php
index bd7a304a1..11573ecd4 100644
--- a/libraries/log4php.debug/LoggerReflectionUtils.php
+++ b/libraries/log4php.debug/LoggerReflectionUtils.php
@@ -44,7 +44,6 @@ class LoggerReflectionUtils {
 	 * @param object $obj The object to configure.
 	 * @param array $properties An array containing keys and values.
 	 * @param string $prefix Only keys having the specified prefix will be set.
-	 * @static
 	 */
 	 // TODO: check, if this is really useful
 	public static function setPropertiesByObject($obj, $properties, $prefix) {
@@ -129,7 +128,6 @@ class LoggerReflectionUtils {
 	 */
 	public static function createObject($class) {
 		if(!empty($class)) {
-			$class = basename($class);
 			return new $class();
 		}
 		return null;
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderAdodb.php b/libraries/log4php.debug/appenders/LoggerAppenderAdodb.php
deleted file mode 100644
index bb6d1de0f..000000000
--- a/libraries/log4php.debug/appenders/LoggerAppenderAdodb.php
+++ /dev/null
@@ -1,263 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @package log4php
- */
-
-/** A docblok to make phpdoc happy */
-require_once(ADODB_DIR . '/adodb.inc.php');
-
-/**
- * Appends log events to a db table using adodb class.
- *
- * <p>This appender uses a table in a database to log events.</p>
- * <p>Parameters are {@link $host}, {@link $user}, {@link $password},
- * {@link $database}, {@link $createTable}, {@link $table} and {@link $sql}.</p>
- * <p>See examples in test directory.</p>
- *
- * @deprecated Use LoggerAppenderPDO instead
- * @package log4php
- * @subpackage appenders
- * @since 0.9
- */
-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);
-	}
-
-	/**
-	 * 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;
-	}
-	
-}
-
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderConsole.php b/libraries/log4php.debug/appenders/LoggerAppenderConsole.php
index c9e53baa1..f1e105208 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderConsole.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderConsole.php
@@ -37,7 +37,7 @@
  * 
  * {@example ../../examples/resources/appender_console.properties 18}
  * 
- * @version $Revision: 1062667 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage appenders
  */
@@ -51,17 +51,13 @@ class LoggerAppenderConsole extends LoggerAppender {
 	 * Default is STDOUT
 	 * @var string
 	 */
-	private $target = self::STDOUT;
+	protected $target = self::STDOUT;
 	
 	/**
 	 * @var mixed the resource used to open stdout/stderr
 	 */
 	protected $fp = null;
 
-	public function __destruct() {
-		$this->close();
-	}
-	
 	/**
 	 * Set console target.
 	 * @param mixed $value a constant or a string
@@ -72,9 +68,16 @@ class LoggerAppenderConsole extends LoggerAppender {
 			$this->target = self::STDOUT;
 		} elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
 			$this->target = self::STDERR;
+		} else {
+			$value = var_export($value);
+			$this->warn("Invalid value given for 'target' property: [$value]. Property not set.");
 		}
 	}
 
+	public function getTarget() {
+		return $this->target;
+	}
+
 	public function activateOptions() {
 		$this->fp = fopen($this->target, 'w');
 		if(is_resource($this->fp) && $this->layout !== null) {
@@ -83,9 +86,6 @@ class LoggerAppenderConsole extends LoggerAppender {
 		$this->closed = (bool)is_resource($this->fp) === false;
 	}
 	
-	/**
-	 * @see LoggerAppender::close()
-	 */
 	public function close() {
 		if($this->closed != true) {
 			if (is_resource($this->fp) && $this->layout !== null) {
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderDailyFile.php b/libraries/log4php.debug/appenders/LoggerAppenderDailyFile.php
index 471c4d781..157eb22f1 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderDailyFile.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderDailyFile.php
@@ -46,7 +46,7 @@
  *
  * The above will create a file like: daily_20090908.log
  *
- * @version $Revision: 1059522 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage appenders
  */
@@ -57,18 +57,14 @@ class LoggerAppenderDailyFile extends LoggerAppenderFile {
 	 * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>.
 	 * @var string
 	 */
-	public $datePattern = "Ymd";
-	
-	public function __destruct() {
-		parent::__destruct();
-	}
+	protected $datePattern = "Ymd";
 	
 	/**
 	 * Sets date format for the file name.
 	 * @param string $datePattern a regular date() string format
 	 */
 	public function setDatePattern($datePattern) {
-		$this->datePattern = $datePattern;
+		$this->setString('datePattern', $datePattern);
 	}
 	
 	/**
@@ -78,15 +74,37 @@ class LoggerAppenderDailyFile extends LoggerAppenderFile {
 		return $this->datePattern;
 	}
 	
-	/**
-	 * Similar to the parent method, but replaces "%s" in the file name with 
-	 * the current date in format specified by $datePattern. 
-	 *
-	 * @see LoggerAppenderFile::setFile()
-	 */
-	public function setFile($file) {
+	/** 
+	 * Similar to parent method, but but replaces "%s" in the file name with 
+	 * the current date in format specified by the 'datePattern' parameter.
+	 */ 
+	public function activateOptions() {
+		$fileName = $this->getFile();
 		$date = date($this->getDatePattern());
-		$file = sprintf($file, $date);
-		parent::setFile(sprintf($file, $date));
+		$fileName = sprintf($fileName, $date);
+		
+		if(!is_file($fileName)) {
+			$dir = dirname($fileName);
+			if(!is_dir($dir)) {
+				mkdir($dir, 0777, true);
+			}
+		}
+	
+		$this->fp = fopen($fileName, ($this->getAppend()? 'a':'w'));
+		if($this->fp) {
+			if(flock($this->fp, LOCK_EX)) {
+				if($this->getAppend()) {
+					fseek($this->fp, 0, SEEK_END);
+				}
+				fwrite($this->fp, $this->layout->getHeader());
+				flock($this->fp, LOCK_UN);
+				$this->closed = false;
+			} else {
+				// TODO: should we take some action in this case?
+				$this->closed = true;
+			}
+		} else {
+			$this->closed = true;
+		}
 	}
 }
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderEcho.php b/libraries/log4php.debug/appenders/LoggerAppenderEcho.php
index 91ae2c395..e53241432 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderEcho.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderEcho.php
@@ -36,32 +36,19 @@
  *    Tue Sep  8 22:44:55 2009,812 [6783] DEBUG appender_echo - Hello World!
  * </pre>
  *
- * @version $Revision: 1062665 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage appenders
  */
 class LoggerAppenderEcho extends LoggerAppender {
 	/** boolean used internally to mark first append */
-	private $firstAppend = true;
+	protected $firstAppend = true;
 	
 	/** 
 	 * If set to true, a <br /> element will be inserted before each line
 	 * break in the logged message. Default value is false. @var boolean 
 	 */
-	private $htmlLineBreaks = false;
-
-	public function __construct($name = '') {
-		parent::__construct($name);
-		$this->firstAppend = true;
-	}
-	
-	public function __destruct() {
-		$this->close();
-	}
-
-	public function activateOptions() {
-		$this->closed = false;
-	}
+	protected $htmlLineBreaks = false;
 	
 	public function close() {
 		if($this->closed != true) {
@@ -88,7 +75,7 @@ class LoggerAppenderEcho extends LoggerAppender {
 	}
 	
 	public function setHtmlLineBreaks($value) {
-		$this->htmlLineBreaks = LoggerOptionConverter::toBoolean($value, false);
+		$this->setBoolean('htmlLineBreaks', $value);
 	}
 
 	public function getHtmlLineBreaks() {
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderFile.php b/libraries/log4php.debug/appenders/LoggerAppenderFile.php
index 4cd6250b9..d1c9bbfb5 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderFile.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderFile.php
@@ -36,7 +36,7 @@
  * 
  * {@example ../../examples/resources/appender_file.properties 18}
  * 
- * @version $Revision: 1062665 $
+ * @version $Revision: 1213663 $
  * @package log4php
  * @subpackage appenders
  */
@@ -45,7 +45,7 @@ class LoggerAppenderFile extends LoggerAppender {
 	/**
 	 * @var boolean if {@link $file} exists, appends events.
 	 */
-	private $append = true;
+	protected $append = true;
 	
 	/**
 	 * @var string the file name used to append events
@@ -57,17 +57,15 @@ class LoggerAppenderFile extends LoggerAppender {
 	 */
 	protected $fp = false;
 	
-	public function __construct($name = '') {
-		parent::__construct($name);
-	}
-
-	public function __destruct() {
-		$this->close();
-	}
-	
 	public function activateOptions() {
 		$fileName = $this->getFile();
 
+		if (empty($fileName)) {
+			$this->warn("Required parameter 'fileName' not set. Closing appender.");
+			$this->closed = true;
+			return;
+		}
+		
 		if(!is_file($fileName)) {
 			$dir = dirname($fileName);
 			if(!is_dir($dir)) {
@@ -122,7 +120,7 @@ class LoggerAppenderFile extends LoggerAppender {
 	 * @param string $file
 	 */
 	public function setFile($file) {
-		$this->file = $file;
+		$this->setString('file', $file);
 	}
 	
 	/**
@@ -139,8 +137,8 @@ class LoggerAppenderFile extends LoggerAppender {
 		return $this->append;
 	}
 
-	public function setAppend($flag) {
-		$this->append = LoggerOptionConverter::toBoolean($flag, true);
+	public function setAppend($append) {
+		$this->setBoolean('append', $append);
 	}
 
 	/**
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderMail.php b/libraries/log4php.debug/appenders/LoggerAppenderMail.php
index ae9ad2a47..a98d51483 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderMail.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderMail.php
@@ -48,43 +48,26 @@
  *      Tue Sep  8 21:51:06 2009,120 [5485] FATAL root - Some more critical message!
  * </pre>
 
- * @version $Revision: 1062665 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage appenders
  */
 class LoggerAppenderMail extends LoggerAppender {
 
 	/** @var string 'from' field */
-	private $from = null;
+	protected $from = null;
 
 	/** @var string 'subject' field */
-	private $subject = 'Log4php Report';
+	protected $subject = 'Log4php Report';
 	
 	/** @var string 'to' field */
-	private $to = null;
+	protected $to = null;
 
 	/** @var indiciates if this appender should run in dry mode */
-	private $dry = false;
+	protected $dry = false;
 
 	/** @var string used to create mail body */
-	private $body = '';
-	
-	/**
-	 * Constructor.
-	 *
-	 * @param string $name appender name
-	 */
-	public function __construct($name = '') {
-		parent::__construct($name);
-	}
-
-	public function __destruct() {
-		$this->close();
-	}
-
-	public function activateOptions() {
-		$this->closed = false;
-	}
+	protected $body = '';
 	
 	public function close() {
 		if($this->closed != true) {
@@ -107,19 +90,19 @@ class LoggerAppenderMail extends LoggerAppender {
 	}
 	
 	public function setSubject($subject) {
-		$this->subject = $subject;
+		$this->setString('subject', $subject);
 	}
 	
 	public function setTo($to) {
-		$this->to = $to;
+		$this->setString('to', $to);
 	}
 
 	public function setFrom($from) {
-		$this->from = $from;
-	}  
+		$this->setString('from', $from);
+	}
 
 	public function setDry($dry) {
-		$this->dry = $dry;
+		$this->setBoolean('dry', $dry);
 	}
 	
 	public function append(LoggerLoggingEvent $event) {
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderMailEvent.php b/libraries/log4php.debug/appenders/LoggerAppenderMailEvent.php
index 5d741affa..34775b5ac 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderMailEvent.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderMailEvent.php
@@ -47,7 +47,7 @@
  *      Tue Sep  8 21:51:04 2009,120 [5485] FATAL root - Some critical message!
  * </pre>
  *
- * @version $Revision: 1137177 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage appenders
  */
@@ -56,43 +56,30 @@ class LoggerAppenderMailEvent extends LoggerAppender {
 	/**  'from' field (defaults to 'sendmail_from' from php.ini on win32).
 	 * @var string
 	 */
-	private $from = null;
+	protected $from;
 
 	/** Mailserver port (win32 only).
 	 * @var integer 
 	 */
-	private $port = 25;
+	protected $port = 25;
 
 	/** Mailserver hostname (win32 only).
 	 * @var string   
 	 */
-	private $smtpHost = null;
+	protected $smtpHost = null;
 
 	/**
 	 * @var string 'subject' field
 	 */
-	private $subject = '';
+	protected $subject = '';
 
 	/**
 	 * @var string 'to' field
 	 */
-	private $to = null;
+	protected $to = null;
 	
 	/** @var indiciates if this appender should run in dry mode */
-	private $dry = false;
-	
-	/**
-	 * Constructor.
-	 *
-	 * @param string $name appender name
-	 */
-	public function __construct($name = '') {
-		parent::__construct($name);
-	}
-
-	public function __destruct() {
-		$this->close();
-	}
+	protected $dry = false;
 	
 	public function activateOptions() {
 		if (empty($this->layout)) {
@@ -110,32 +97,28 @@ class LoggerAppenderMailEvent extends LoggerAppender {
 		$this->closed = false;
 	}
 	
-	public function close() {
-		$this->closed = true;
-	}
-
 	public function setFrom($from) {
-		$this->from = $from;
+		$this->setString('from', $from);
 	}
 	
 	public function setPort($port) {
-		$this->port = (int)$port;
+		$this->setPositiveInteger('port', $port);
 	}
 	
 	public function setSmtpHost($smtpHost) {
-		$this->smtpHost = $smtpHost;
+		$this->setString('smtpHost', $smtpHost);
 	}
 	
 	public function setSubject($subject) {
-		$this->subject = $subject;
+		$this->setString('subject',  $subject);
 	}
 	
 	public function setTo($to) {
-		$this->to = $to;
+		$this->setString('to',  $to);
 	}
 
 	public function setDry($dry) {
-		$this->dry = $dry;
+		$this->setBoolean('dry', $dry);
 	}
 	
 	public function append(LoggerLoggingEvent $event) {
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderMongoDB.php b/libraries/log4php.debug/appenders/LoggerAppenderMongoDB.php
index b44e80ffc..401167bfd 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderMongoDB.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderMongoDB.php
@@ -216,16 +216,12 @@ class LoggerAppenderMongoDB extends LoggerAppender {
 		}
 	}
 	
-	public function __destruct() {
-		$this->close();
-	}
-	
 	/** Sets the value of {@link $host} parameter. */
 	public function setHost($host) {
 		if (!preg_match('/^mongodb\:\/\//', $host)) {
 			$host = self::DEFAULT_MONGO_URL_PREFIX . $host;
-		}			
-		$this->host = $host;				
+		}
+		$this->host = $host;
 	}
 		
 	/** Returns the value of {@link $host} parameter. */
@@ -235,7 +231,7 @@ class LoggerAppenderMongoDB extends LoggerAppender {
 		
 	/** Sets the value of {@link $port} parameter. */
 	public function setPort($port) {
-		$this->port = $port;
+		$this->setPositiveInteger('port', $port);
 	}
 		
 	/** Returns the value of {@link $port} parameter. */
@@ -245,7 +241,7 @@ class LoggerAppenderMongoDB extends LoggerAppender {
 		
 	/** Sets the value of {@link $databaseName} parameter. */
 	public function setDatabaseName($databaseName) {
-		$this->databaseName = $databaseName;
+		$this->setString('databaseName', $databaseName);
 	}
 		
 	/** Returns the value of {@link $databaseName} parameter. */
@@ -255,7 +251,7 @@ class LoggerAppenderMongoDB extends LoggerAppender {
 	
 	/** Sets the value of {@link $collectionName} parameter. */
 	public function setCollectionName($collectionName) {
-		$this->collectionName = $collectionName;
+		$this->setString('collectionName', $collectionName);
 	}
 		
 	/** Returns the value of {@link $collectionName} parameter. */
@@ -265,7 +261,7 @@ class LoggerAppenderMongoDB extends LoggerAppender {
 		
 	/** Sets the value of {@link $userName} parameter. */
 	public function setUserName($userName) {
-		$this->userName = $userName;
+		$this->setString('userName', $userName, true);
 	}
 	
 	/** Returns the value of {@link $userName} parameter. */
@@ -275,7 +271,7 @@ class LoggerAppenderMongoDB extends LoggerAppender {
 		
 	/** Sets the value of {@link $password} parameter. */
 	public function setPassword($password) {
-		$this->password = $password;
+		$this->setString('password', $password, true);
 	}
 		
 	/** Returns the value of {@link $password} parameter. */
@@ -299,4 +295,4 @@ class LoggerAppenderMongoDB extends LoggerAppender {
 		return $this->collection;
 	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderNull.php b/libraries/log4php.debug/appenders/LoggerAppenderNull.php
index 313a10402..0de2a949a 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderNull.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderNull.php
@@ -29,26 +29,17 @@
  * 
  * {@example ../../examples/resources/appender_null.properties 18}
  * 
- * @version $Revision: 1059292 $
+ * @version $Revision: 1166182 $
  * @package log4php
  * @subpackage appenders
  */
 class LoggerAppenderNull extends LoggerAppender {
 
+	/** 
+	 * This appender does not require a layout. 
+	 */
 	protected $requiresLayout = false;
 	
-	public function __destruct() {
-		$this->close();
-	}
-	
-	public function activateOptions() {
-		$this->closed = false;
-	}
-	
-	public function close() {
-		$this->closed = true;
-	}
-	
 	/**
 	 * Do nothing. 
 	 * 
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderPDO.php b/libraries/log4php.debug/appenders/LoggerAppenderPDO.php
index 349276f2b..8bd27b8f8 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderPDO.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderPDO.php
@@ -50,87 +50,74 @@ class LoggerAppenderPDO extends LoggerAppender {
 	 * Create the log table if it does not exists (optional).
 	 * @var string 
 	 */
-	private $createTable = true;
+	protected $createTable = true;
 	
 	/** 
 	 * Database user name.
 	 * @var string 
 	 */
-	private $user = '';
+	protected $user;
 	
 	/** 
 	 * Database password
 	 * @var string 
 	 */
-	private $password = '';
+	protected $password;
 	
 	/** 
 	 * DSN string for enabling a connection.
 	 * @var string 
 	 */
-	private $dsn;
+	protected $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;
+	protected $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 (?,?,?,?,?,?,?)";
+	protected $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";
+	protected $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';
+	protected $table = 'log4php_log';
 	
 	/** 
 	 * The PDO instance.
 	 * @var PDO 
 	 */
-	private $db = null;
+	protected $db = null;
 	
 	/** 
 	 * Prepared statement for the INSERT INTO query.
 	 * @var PDOStatement 
 	 */
-	private $preparedInsert;
+	protected $preparedInsert;
 
 	/** 
 	 * Set in activateOptions() and later used in append() to check if all conditions to append are true.
 	 * @var boolean 
 	 */
-	private $canAppend = true;
+	protected $canAppend = true;
 	
 	/**
 	 * This appender does not require a layout.
 	 */
 	protected $requiresLayout = false;
 	
-	/**
-	 * Constructor.
-	 * This apender doesn't require a layout.
-	 * @param string $name appender name
-	 */
-	public function __construct($name = '') {
-		parent::__construct($name);
-	}
-	
-	public function __destruct() {
-	   $this->close();
-   	}
-   	
 	/**
 	 * Setup db connection.
 	 * Based on defined options, this method connects to db defined in {@link $dsn}
@@ -237,7 +224,7 @@ class LoggerAppenderPDO extends LoggerAppender {
 	 * Defaults to ''
 	 */
 	public function setUser($user) {
-		$this->user = $user;
+		$this->setString('user', $user);
 	}
 	
 	/**
@@ -245,7 +232,7 @@ class LoggerAppenderPDO extends LoggerAppender {
 	 * Defaults to ''
 	 */
 	public function setPassword($password) {
-		$this->password = $password;
+		$this->setString('password', $password);
 	}
 	
 	/**
@@ -253,7 +240,7 @@ class LoggerAppenderPDO extends LoggerAppender {
 	 * if its not existing.
 	 */
 	public function setCreateTable($flag) {
-		$this->createTable = LoggerOptionConverter::toBoolean($flag, true);
+		$this->setBoolean('createTable', $flag);
 	}
    
    	/**
@@ -270,7 +257,7 @@ class LoggerAppenderPDO extends LoggerAppender {
 	 * @deprecated See {@link setInsertSql} and {@link setInsertPattern}.
 	 */
 	public function setSql($sql) {
-		$this->sql = $sql;	
+		$this->setString('sql', $sql);
 	}
 	
 	/**
@@ -279,7 +266,7 @@ class LoggerAppenderPDO extends LoggerAppender {
 	 * @param $sql		  A complete INSERT INTO query with "?" that gets replaced.
 	 */
 	public function setInsertSql($sql) {
-		$this->insertSql = $sql;
+		$this->setString('insertSql', $sql);
 	}
 
 	/**
@@ -290,7 +277,7 @@ class LoggerAppenderPDO extends LoggerAppender {
 	 * @param $pattern		  Comma separated format strings like "%p,%m,%C"
 	 */
 	public function setInsertPattern($pattern) {
-		$this->insertPattern = $pattern;
+		$this->setString('insertPattern', $pattern);
 	}
 
 	/**
@@ -298,7 +285,7 @@ class LoggerAppenderPDO extends LoggerAppender {
 	 * Defaults to log4php_log
 	 */
 	public function setTable($table) {
-		$this->table = $table;
+		$this->setString('table', $table);
 	}
 	
 	/**
@@ -306,7 +293,7 @@ class LoggerAppenderPDO extends LoggerAppender {
 	 * SQLite it could look like this: 'sqlite:appenders/pdotest.sqlite'
 	 */
 	public function setDSN($dsn) {
-		$this->dsn = $dsn;
+		$this->setString('dsn', $dsn);
 	}
 	
 	/**
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderPhp.php b/libraries/log4php.debug/appenders/LoggerAppenderPhp.php
index cd950ff42..9840d8000 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderPhp.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderPhp.php
@@ -23,10 +23,11 @@
  *
  * This appender has no configurable parameters.
  *
- * <p>Levels are mapped as follows:</p>
- * - <b>level &lt; WARN</b> mapped to E_USER_NOTICE
- * - <b>WARN &lt;= level &lt; ERROR</b> mapped to E_USER_WARNING
- * - <b>level &gt;= ERROR</b> mapped to E_USER_ERROR  
+ * Levels are mapped as follows:
+ * 
+ * - <b>level < WARN</b> mapped to E_USER_NOTICE
+ * - <b>WARN <= level < ERROR</b> mapped to E_USER_WARNING
+ * - <b>level >= ERROR</b> mapped to E_USER_ERROR  
  *
  * An example:
  * 
@@ -34,28 +35,12 @@
  * 
  * {@example ../../examples/resources/appender_php.properties 18}
  *
- * @version $Revision: 1062665 $
+ * @version $Revision: 1166182 $
  * @package log4php
  * @subpackage appenders
  */ 
 class LoggerAppenderPhp extends LoggerAppender {
 
-	public function __construct($name = '') {
-		parent::__construct($name);
-	}
-	
-	public function __destruct() {
-		$this->close();
-	}
-	
-	public function activateOptions() {
-		$this->closed = false;
-	}
-
-	public function close() {
-		$this->closed = true;
-	}
-
 	public function append(LoggerLoggingEvent $event) {
 		if($this->layout !== null) {
 			$level = $event->getLevel();
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderRollingFile.php b/libraries/log4php.debug/appenders/LoggerAppenderRollingFile.php
index f6a9c3222..a00eacd8b 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderRollingFile.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderRollingFile.php
@@ -42,7 +42,7 @@
  *
  * {@example ../../examples/resources/appender_socket.properties 18}
  *
- * @version $Revision: 1134244 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage appenders
  */
@@ -64,7 +64,7 @@ class LoggerAppenderRollingFile extends LoggerAppenderFile {
 	 *
 	 * @var integer
 	 */
-	private $maxFileSize = 10485760;
+	protected $maxFileSize = 10485760;
 	
 	/**
 	 * Set the maximum number of backup files to keep around.
@@ -78,17 +78,13 @@ class LoggerAppenderRollingFile extends LoggerAppenderFile {
 	 *
 	 * @var integer 
 	 */
-	private $maxBackupIndex	 = 1;
+	protected $maxBackupIndex = 1;
 	
 	/**
 	 * @var string the filename expanded
 	 */
 	private $expandedFileName = null;
 
-	public function __destruct() {
-		parent::__destruct();
-	}
-	
 	/**
 	 * Returns the value of the MaxBackupIndex option.
 	 * @return integer 
@@ -166,9 +162,7 @@ class LoggerAppenderRollingFile extends LoggerAppenderFile {
 	 * @param mixed $maxBackups
 	 */
 	public function setMaxBackupIndex($maxBackups) {
-		if(is_numeric($maxBackups)) {
-			$this->maxBackupIndex = abs((int)$maxBackups);
-		}
+		$this->setPositiveInteger('maxBackupIndex', $maxBackups);
 	}
 
 	/**
@@ -197,24 +191,7 @@ class LoggerAppenderRollingFile extends LoggerAppenderFile {
 	 * @return the actual file size set
 	 */
 	public function setMaxFileSize($value) {
-		$maxFileSize = null;
-		$numpart = substr($value,0, strlen($value) -2);
-		$suffix = strtoupper(substr($value, -2));
-
-		switch($suffix) {
-			case 'KB': $maxFileSize = (int)((int)$numpart * 1024); break;
-			case 'MB': $maxFileSize = (int)((int)$numpart * 1024 * 1024); break;
-			case 'GB': $maxFileSize = (int)((int)$numpart * 1024 * 1024 * 1024); break;
-			default:
-				if(is_numeric($value)) {
-					$maxFileSize = (int)$value;
-				}
-		}
-		
-		if($maxFileSize !== null) {
-			$this->maxFileSize = abs($maxFileSize);
-		}
-		return $this->maxFileSize;
+		$this->setFileSize('maxFileSize', $value);
 	}
 
 	public function append(LoggerLoggingEvent $event) {
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderSocket.php b/libraries/log4php.debug/appenders/LoggerAppenderSocket.php
index 78477b8a3..3fc362371 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderSocket.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderSocket.php
@@ -19,245 +19,104 @@
  */
 
 /**
- * Serialize events and send them to a network socket.
+ * Appends events to a network socket.
  *
  * This appender can be configured by changing the following attributes:
  * 
- * - locationInfo       - Sets the location info for the xml layout (true or false)
- * - log4jNamespace     - Sets the namespace for log4j (true or false)
- * - port               - Sets the port of the socket.
- * - remoteHost         - Sets the remote host
- * - timeout            - Sets the timeout in ms
- * - useXml             - true, if xml should be transmitted.
- *                        false, if a serialized php object should be transmitted
- *
- * Parameters are {@link $remoteHost}, {@link $port}, {@link $timeout}, 
- * {@link $locationInfo}, {@link $useXml} and {@link $log4jNamespace}.
- *
- * An example:
- * 
- * {@example ../../examples/php/appender_socket.php 19}
+ * - remoteHost - Target remote host.
+ * - port       - Target port (optional, defaults to 4446).
+ * - timeout    - Connection timeout in seconds (optional, defaults to
+ *                'default_socket_timeout' from php.ini)
  * 
- * {@example ../../examples/resources/appender_socket.properties 18}
+ * The socket will by default be opened in blocking mode.
  * 
- * @version $Revision: 1062667 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage appenders
  */ 
 class LoggerAppenderSocket extends LoggerAppender {
-
-	/**
-	 * This appender does not require a layout.
-	 */
-	protected $requiresLayout = false;
-	
-	/**
-	 * @var mixed socket connection resource
-	 */
-	private $sp = false;
-	
-	/**
-	 * Target host. On how to define remote hostaname see 
-	 * {@link PHP_MANUAL#fsockopen}
-	 * @var string 
-	 */
-	private $remoteHost = '';
 	
-	/**
-	 * @var integer the network port.
+	/** 
+	 * Target host.
+	 * @see http://php.net/manual/en/function.fsockopen.php 
 	 */
-	private $port = 4446;
+	protected $remoteHost;
 	
-	/**
-	 * @var boolean get event's location info.
-	 */
-	private $locationInfo = false;
+	/** Target port */
+	protected $port = 4446;
 	
-	/**
-	 * @var integer connection timeout
-	 */
-	private $timeout = 30;
+	/** Connection timeout in ms. */
+	protected $timeout;
 	
-	/**
-	 * @var boolean output events via {@link LoggerXmlLayout}
-	 */
-	private $useXml = false;
+	// ******************************************
+	// *** Appender methods                   ***
+	// ******************************************
 	
-	/**
-	 * @var boolean forward this option to {@link LoggerXmlLayout}. 
-	 *				Ignored if {@link $useXml} is <i>false</i>.
-	 */
-	private $log4jNamespace = false;
-
-	/**
-	 * @var LoggerXmlLayout
-	 */
-	private $xmlLayout = null;
-	
-	/** @var indiciates if this appender should run in dry mode */
-	private $dry = false;
-	
-	public function __destruct() {
-		$this->close();
+	/** Override the default layout to use serialized. */
+	public function getDefaultLayout() {
+		return new LoggerLayoutSerialized();
 	}
 	
-	/**
-	 * Create a socket connection using defined parameters
-	 */
 	public function activateOptions() {
-		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)");
-			}
+		if (empty($this->remoteHost)) {
+			$this->warn("Required parameter [remoteHost] not set. Closing appender.");
+			$this->closed = true;
+			return;
 		}
-		if($this->getUseXml()) {
-			$this->xmlLayout = LoggerReflectionUtils::createObject('LoggerLayoutXml');
-			if($this->xmlLayout === null) {
-				$this->setUseXml(false);
-			} else {
-				$this->xmlLayout->setLocationInfo($this->getLocationInfo());
-				$this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace());
-				$this->xmlLayout->activateOptions();
-			}			 
+	
+		if (empty($this->timeout)) {
+			$this->timeout = ini_get("default_socket_timeout");
 		}
+	
 		$this->closed = false;
 	}
 	
-	public function close() {
-		if($this->closed != true) {
-			if(!$this->dry and $this->sp !== false) {
-				fclose($this->sp);
-			}
+	public function append(LoggerLoggingEvent $event) {
+		$socket = fsockopen($this->remoteHost, $this->port, $errno, $errstr, $this->timeout);
+		if ($socket === false) {
+			$this->warn("Could not open socket to {$this->remoteHost}:{$this->port}. Closing appender.");
 			$this->closed = true;
+			return;
 		}
-	}
-
-	public function setDry($dry) {
-		$this->dry = $dry;
-	}
 	
-	/**
-	 * @return string
-	 */
-	public function getHostname() {
-		return $this->getRemoteHost();
+		if (false === fwrite($socket, $this->layout->format($event))) {
+			$this->warn("Error writing to socket. Closing appender.");
+			$this->closed = true;
+		}
+		fclose($socket);
 	}
 	
-	/**
-	 * @return boolean
-	 */
-	public function getLocationInfo() {
-		return $this->locationInfo;
-	} 
-	 
-	/**
-	 * @return boolean
-	 */
-	public function getLog4jNamespace() {
-		return $this->log4jNamespace;
-	}
-
-	/**
-	 * @return integer
-	 */
-	public function getPort() {
-		return $this->port;
-	}
+	// ******************************************
+	// *** Accessor methods                   ***
+	// ******************************************
 	
-	public function getRemoteHost() {
-		return $this->remoteHost;
+	/** Sets the target host. */
+	public function setRemoteHost($hostname) {
+		$this->setString('remoteHost', $hostname);
 	}
 	
-	/**
-	 * @return integer
-	 */
-	public function getTimeout() {
-		return $this->timeout;
+	/** Sets the target port */
+	public function setPort($port) {
+		$this->setPositiveInteger('port', $port);
 	}
-	
-	/**
-	 * @var boolean
-	 */
-	public function getUseXml() {
-		return $this->useXml;
-	} 
 	 
-	public function reset() {
-		$this->close();
-		parent::reset();
-	}
-
-	/**
-	 * @param mixed
-	 */
-	public function setLocationInfo($flag) {
-		$this->locationInfo = LoggerOptionConverter::toBoolean($flag, $this->getLocationInfo());
-	} 
-
-	/**
-	 * @param mixed
-	 */
-	public function setLog4jNamespace($flag) {
-		$this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, $this->getLog4jNamespace());
-	} 
-			
-	/**
-	 * @param integer
-	 */
-	public function setPort($port) {
-		$port = LoggerOptionConverter::toInt($port, 0);
-		if($port > 0 and $port < 65535) {
-			$this->port = $port;	
-		}
+	/** Sets the timeout. */
+	public function setTimeout($timeout) {
+		$this->setPositiveInteger('timeout', $timeout);
 	}
 	
-	/**
-	 * @param string
-	 */
-	public function setRemoteHost($hostname) {
-		$this->remoteHost = $hostname;
+	/** Returns the target host. */
+	public function getRemoteHost() {
+		return $this->getRemoteHost();
 	}
 	
-	/**
-	 * @param integer
-	 */
-	public function setTimeout($timeout) {
-		$this->timeout = LoggerOptionConverter::toInt($timeout, $this->getTimeout());
+	/** Returns the target port. */
+	public function getPort() {
+		return $this->port;
 	}
 	
-	/**
-	 * @param mixed
-	 */
-	public function setUseXml($flag) {
-		$this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml());
-	} 
- 
-	public function append(LoggerLoggingEvent $event) {
-		if($this->sp || $this->dry) {
-			if($this->getLocationInfo()) {
-				$event->getLocationInformation();
-			}
-		
-			if(!$this->getUseXml()) {
-				$sEvent = serialize($event);
-				if(!$this->dry) {
-					fwrite($this->sp, $sEvent, strlen($sEvent));
-				} else {
-					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);
-				}
-			}
-
-			// not sure about it...
-			if(!$this->dry) {
-				fflush($this->sp);
-			}
-		}
+	/** Returns the timeout */
+	public function getTimeout() {
+		return $this->timeout;
 	}
 }
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderSyslog.php b/libraries/log4php.debug/appenders/LoggerAppenderSyslog.php
index 9b0b42a38..7b7b5eb9c 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderSyslog.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderSyslog.php
@@ -19,28 +19,47 @@
  */
 
 /**
- * Log events using php {@link PHP_MANUAL#syslog} function.
+ * Log events to a system log using the {@link PHP_MANUAL#syslog} function.
  *
- * This appender can be configured by changing the following attributes:
+ * This appenders requires a layout.
+ *
+ * Configurable parameters:
  * 
- * - layout           - Sets the layout class for this appender
- * - ident            - Set the ident of the syslog message.
- * - priority         - Set the priority value for the syslog message.
- * - facility         - Set the facility value for the syslog message
- * - overridePriority - If the priority of the message to be sent can be 
- *                      defined by a value in the properties-file, set 
- *                      parameter value to "true"
- * - option           - Set the option value for the syslog message. 
- *                      This value is used as a parameter for php openlog()
- *                      and passed on to the syslog daemon.
+ * - ident            - The ident of the syslog message.
+ * - priority         - The priority for the syslog message (used when overriding priority).
+ * - facility         - The facility for the syslog message
+ * - overridePriority - If set to true, the message priority will always use 
+ *                      the value defined in {@link $priority}, otherwise the
+ *                      priority will be determined by the message's log level.  
+ * - option           - The option value for the syslog message. 
+ *
+ * Recognised syslog options are:
+ * 	- CONS 	 - if there is an error while sending data to the system logger, write directly to the system console
+ * 	- NDELAY - open the connection to the logger immediately
+ * 	- ODELAY - delay opening the connection until the first message is logged (default)
+ * 	- PERROR - print log message also to standard error
+ * 	- PID    - include PID with each message
+ * 
+ * Multiple options can be set by delimiting them with a pipe character, 
+ * e.g.: "CONS|PID|PERROR".
+ * 
+ * Recognised syslog priorities are:
+ * 	- EMERG
+ * 	- ALERT
+ * 	- CRIT
+ * 	- ERR
+ * 	- WARNING
+ * 	- NOTICE
+ * 	- INFO
+ * 	- DEBUG
  *
  * Levels are mapped as follows:
- * - <b>level >= FATAL</b> to LOG_ALERT
- * - <b>FATAL > level >= ERROR</b> to LOG_ERR 
- * - <b>ERROR > level >= WARN</b> to LOG_WARNING
- * - <b>WARN  > level >= INFO</b> to LOG_INFO
- * - <b>INFO  > level >= DEBUG</b> to LOG_DEBUG
- * - <b>DEBUG > level >= TRACE</b> to LOG_DEBUG
+ * - <b>FATAL</b> to LOG_ALERT
+ * - <b>ERROR</b> to LOG_ERR 
+ * - <b>WARN</b> to LOG_WARNING
+ * - <b>INFO</b> to LOG_INFO
+ * - <b>DEBUG</b> to LOG_DEBUG
+ * - <b>TRACE</b> to LOG_DEBUG
  *
  * An example:
  *
@@ -48,7 +67,7 @@
  *
  * {@example ../../examples/resources/appender_syslog.properties 18}
  *
- * @version $Revision: 1062665 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage appenders
  */ 
@@ -56,114 +75,169 @@ class LoggerAppenderSyslog extends LoggerAppender {
 	
 	/**
 	 * The ident string is added to each message. Typically the name of your application.
-	 *
-	 * @var string Ident for your application
+	 * 
+	 * @var string 
 	 */
-	private $_ident = "Log4PHP Syslog-Event";
+	protected $ident = "Apache log4php";
 
 	/**
-	 * The priority parameter value indicates the level of importance of the message.
-	 * It is passed on to the Syslog daemon.
+	 * The syslog priority to use when overriding priority. This setting is 
+	 * required if {@link overridePriority} is set to true. 
 	 * 
-	 * @var int Syslog priority
+	 * @var string 
 	 */
-	private $_priority;
+	protected $priority;
 	
 	/**
-	 * The option used when generating a log message.
-	 * It is passed on to the Syslog daemon.
+	 * The option used when opening the syslog connection.
 	 * 
-	 * @var int Syslog priority
+	 * @var string
 	 */
-	private $_option;
+	protected $option = 'PID|CONS';
 	
 	/**
 	 * The facility value indicates the source of the message.
-	 * It is passed on to the Syslog daemon.
 	 *
-	 * @var const int Syslog facility
+	 * @var string
 	 */
-	private $_facility;
+	protected $facility = 'USER';
 	
 	/**
-	 * If it is necessary to define logging priority in the .properties-file,
-	 * set this variable to "true".
+	 * If set to true, the message priority will always use the value defined 
+	 * in {@link $priority}, otherwise the priority will be determined by the 
+	 * message's log level.
 	 *
-	 * @var const int value indicating whether the priority of the message is defined in the .properties-file
-	 *				   (or properties-array)
+	 * @var string
 	 */
-	private $_overridePriority;
-
-	/** @var indiciates if this appender should run in dry mode */
-	private $dry = false;
+	protected $overridePriority = false;
 
-	public function __construct($name = '') {
-		parent::__construct($name);
-	}
-
-	public function __destruct() {
-		$this->close();
-	}
+	/**
+	 * Holds the int value of the {@link $priority}.
+	 * @var int
+	 */
+	private $intPriority;
 	
-	public function setDry($dry) {
-		$this->dry = $dry;
-	}
+	/**
+	 * Holds the int value of the {@link $facility}.
+	 * @var int
+	 */
+	private $intFacility;
 	
 	/**
-	 * Set the ident of the syslog message.
+	 * Holds the int value of the {@link $option}.
+	 * @var int
+	 */
+	private $intOption;
+	
+	/** Maps log4php levels to equivalent syslog priorities. */
+	private $levelMap = array(
+		LoggerLevel::TRACE => LOG_DEBUG,
+		LoggerLevel::DEBUG => LOG_DEBUG,
+		LoggerLevel::INFO  => LOG_INFO,
+		LoggerLevel::WARN  => LOG_WARNING,
+		LoggerLevel::ERROR => LOG_ERR,
+		LoggerLevel::FATAL => LOG_ALERT,
+	);
+
+	/**
+	 * Sets the {@link $ident}.
 	 *
-	 * @param string Ident
+	 * @param string $ident
 	 */
 	public function setIdent($ident) {
-		$this->_ident = $ident; 
+		$this->ident = $ident; 
 	}
-
+	
 	/**
-	 * Set the priority value for the syslog message.
+	 * Sets the {@link $priority}.
 	 *
-	 * @param const int Priority
+	 * @param string $priority
 	 */
 	public function setPriority($priority) {
-		$this->_priority = $priority;
+		$this->priority = $priority;
 	}
 	
-	
 	/**
-	 * Set the facility value for the syslog message.
+	 * Sets the {@link $facility}.
 	 *
-	 * @param const int Facility
+	 * @param string $facility
 	 */
 	public function setFacility($facility) {
-		$this->_facility = $facility;
+		$this->facility = $facility;
 	} 
 	
 	/**
-	 * If the priority of the message to be sent can be defined by a value in the properties-file, 
-	 * set parameter value to "true".
+	 * Sets the {@link $overridePriority}.
 	 *
-	 * @param bool Override priority
+	 * @param string $overridePriority
 	 */
 	public function setOverridePriority($overridePriority) {
-		$this->_overridePriority = $overridePriority;
+		$this->overridePriority = $overridePriority;
 	} 
 	
 	/**
-	 * Set the option value for the syslog message.
-	 * This value is used as a parameter for php openlog()	
-	 * and passed on to the syslog daemon.
+	* Sets the {@link $option}.
+	*
+	* @param string $option
+	*/
+	public function setOption($option) {
+		$this->option = $option;
+	}
+	
+	/**
+	* Returns the {@link $ident}.
+	*
+	* @return string $ident
+	*/
+	public function getIdent() {
+		return $this->ident;
+	}
+	
+	/**
+	 * Returns the {@link $priority}.
 	 *
-	 * @param string	$option
+	 * @return string
 	 */
-	public function setOption($option) {
-		$this->_option = $option;
+	public function getPriority() {
+		return $this->priority;
 	}
 	
+	/**
+	 * Returns the {@link $facility}.
+	 *
+	 * @return string
+	 */
+	public function getFacility() {
+		return $this->facility;
+	}
+	
+	/**
+	 * Returns the {@link $overridePriority}.
+	 *
+	 * @return string
+	 */
+	public function getOverridePriority() {
+		return $this->overridePriority;
+	}
+	
+	/**
+	 * Returns the {@link $option}.
+	 *
+	 * @return string
+	 */
+	public function getOption() {
+		return $this->option;
+	}
+	
+	
 	public function activateOptions() {
-		// Deprecated as of 5.3 and removed in 6.0
-		// define_syslog_variables();
+		$this->intPriority = $this->parsePriority();
+		$this->intOption   = $this->parseOption();
+		$this->intFacility = $this->parseFacility();
+		
 		$this->closed = false;
 	}
-
+	
 	public function close() {
 		if($this->closed != true) {
 			closelog();
@@ -171,44 +245,78 @@ class LoggerAppenderSyslog extends LoggerAppender {
 		}
 	}
 
+	/** 
+	 * Appends the event to syslog.
+	 * 
+	 * Log is opened and closed each time because if it is not closed, it
+	 * can cause the Apache httpd server to log to whatever ident/facility 
+	 * was used in openlog().
+	 *
+	 * @see http://www.php.net/manual/en/function.syslog.php#97843
+	 */
 	public function append(LoggerLoggingEvent $event) {
-		if($this->_option == NULL){
-			$this->_option = LOG_PID | LOG_CONS;
+		$priority = $this->getSyslogPriority($event->getLevel());
+		$message = $this->layout->format($event);
+	
+		openlog($this->ident, $this->intOption, $this->intFacility);
+		syslog($priority, $message);
+		closelog();
+	}
+	
+	/** Determines which syslog priority to use based on the given level. */
+	private function getSyslogPriority(LoggerLevel $level) {
+		if($this->overridePriority) {
+			return $this->intPriority;
 		}
 		
-		$level	 = $event->getLevel();
-		if($this->layout === null) {
-			$message = $event->getRenderedMessage();
+		$int = $level->toInt();
+		
+		if (isset($this->levelMap[$int])) {
+			return $this->levelMap[$int];
 		} else {
-			$message = $this->layout->format($event); 
+			return LOG_DEBUG;
 		}
-
-		// If the priority of a syslog message can be overridden by a value defined in the properties-file,
-		// use that value, else use the one that is defined in the code.
-		if(!$this->dry) {
-			// Attach the process ID to the message, use the facility defined in the .properties-file
-			openlog($this->_ident, $this->_option, $this->_facility);
-		
-			if($this->_overridePriority) {
-				syslog($this->_priority, $message);			   
-			} else {
-				if($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) {
-					syslog(LOG_ALERT, $message);
-				} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
-					syslog(LOG_ERR, $message);		  
-				} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
-					syslog(LOG_WARNING, $message);
-				} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) {
-					syslog(LOG_INFO, $message);
-				} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) {
-					syslog(LOG_DEBUG, $message);
-				} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelTrace())) {
-					syslog(LOG_DEBUG, $message);	// No trace level in syslog
+	}
+	
+	/** Parses a syslog option string and returns the correspodning int value. */
+	private function parseOption() {
+		$value = 0;
+		$options = explode('|', $this->option);
+	
+		foreach($options as $option) {
+			if (!empty($option)) {
+				$constant = "LOG_" . trim($option);
+				if (defined($constant)) {
+					$value |= constant($constant);
+				} else {
+					trigger_error("log4php: Invalid syslog option provided: $option. Whole option string: {$this->option}.", E_USER_WARNING);
 				}
 			}
-			closelog();
-		} else {
-			echo "DRY MODE OF SYSLOG APPENDER: ".$message;
 		}
+		return $value;
+	}
+	
+	/** Parses the facility string and returns the corresponding int value. */
+	private function parseFacility() {
+		if (!empty($this->facility)) {   
+			$constant = "LOG_" . trim($this->facility);
+			if (defined($constant)) {
+				return constant($constant);
+			} else {
+				trigger_error("log4php: Invalid syslog facility provided: {$this->facility}.", E_USER_WARNING);
+			}
+		}
+	}
+
+	/** Parses the priority string and returns the corresponding int value. */
+	private function parsePriority() {
+		if (!empty($this->priority)) {
+			$constant = "LOG_" . trim($this->priority);
+			if (defined($constant)) {
+				return constant($constant);
+			} else {
+				trigger_error("log4php: Invalid syslog priority provided: {$this->priority}.", E_USER_WARNING);
+			}
+		}	
 	}
 }
diff --git a/libraries/log4php.debug/configurators/LoggerConfiguratorBasic.php b/libraries/log4php.debug/configurators/LoggerConfigurationAdapter.php
similarity index 53%
rename from libraries/log4php.debug/configurators/LoggerConfiguratorBasic.php
rename to libraries/log4php.debug/configurators/LoggerConfigurationAdapter.php
index 5b0ef2003..a9bd8fd9c 100644
--- a/libraries/log4php.debug/configurators/LoggerConfiguratorBasic.php
+++ b/libraries/log4php.debug/configurators/LoggerConfigurationAdapter.php
@@ -1,47 +1,40 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @package log4php
- */
-
-/**
- * Use this class to quickly configure the package.
- *
- * An example how to use this configurator:
- * 
- * {@example ../../examples/php/configurator_basic.php 19}
- *
- * @version $Revision: 883108 $
- * @package log4php
- * @subpackage configurators
- */
-class LoggerConfiguratorBasic implements LoggerConfigurator {
-
-	/**
-	 * Add a {@link LoggerAppenderConsole} that uses 
-	 * the {@link LoggerLayoutTTCC} to the root category.
-	 * 
-	 * @param string $url not used here
-	 */
-	public function configure(LoggerHierarchy $hierarchy, $url = null) {
-		$root = $hierarchy->getRootLogger();
-		$appender = new LoggerAppenderConsole('A1');
-		$appender->setLayout( new LoggerLayoutTTCC() );
-		$appender->activateOptions();
-		$root->addAppender($appender);
-	}
-}
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * @package log4php
+ */
+
+/**
+ * The interface for configurator adapters.
+ * 
+ * Adapters convert configuration in several formats such as XML, ini and PHP 
+ * file to a PHP array. 
+ * 
+ * @package log4php
+ * @subpackage configurators
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version $Revision$
+ * @since 2.2
+ */
+interface LoggerConfigurationAdapter
+{
+	/** Converts the configuration file to PHP format usable by the configurator. */
+	public function convert($input); 
+
+}
+
+?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/configurators/LoggerConfigurationAdapterINI.php b/libraries/log4php.debug/configurators/LoggerConfigurationAdapterINI.php
new file mode 100644
index 000000000..bcee40ff9
--- /dev/null
+++ b/libraries/log4php.debug/configurators/LoggerConfigurationAdapterINI.php
@@ -0,0 +1,306 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * @package log4php
+ */
+
+/**
+ * Converts ini configuration files to a PHP array.
+ * 
+ * These used to be called "properties" files (inherited from log4j), and that 
+ * file extension is still supported. 
+ *
+ * @package log4php
+ * @subpackage configurators
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version $Revision$
+ * @since 2.2
+ */
+class LoggerConfigurationAdapterINI implements LoggerConfigurationAdapter {
+	
+	/** Name to assign to the root logger. */
+	const ROOT_LOGGER_NAME = "root";
+
+	/** Prefix used for defining logger additivity. */
+	const ADDITIVITY_PREFIX = "log4php.additivity.";
+	
+	/** Prefix used for defining logger threshold. */
+	const THRESHOLD_PREFIX = "log4php.threshold";
+	
+	/** Prefix used for defining the root logger. */
+	const ROOT_LOGGER_PREFIX = "log4php.rootLogger";
+	
+	/** Prefix used for defining a logger. */
+	const LOGGER_PREFIX = "log4php.logger.";
+	
+	/** Prefix used for defining an appender. */
+	const APPENDER_PREFIX = "log4php.appender.";
+	
+	/** Prefix used for defining a renderer. */
+	const RENDERER_PREFIX = "log4php.renderer.";
+	
+	/** Holds the configuration. */
+	private $config = array();
+	
+	/**
+	 * Loads and parses the INI configuration file.
+	 * 
+	 * INI_SCANNER_RAW is used here because otherwise parse_ini_file() will 
+	 * try to parse all values, with some strange results. For example, "true"
+	 * will become "1", while "false" and "null" will become "" (empty string). 
+	 * 
+	 * @see http://php.net/manual/en/function.parse-ini-file.php
+	 * 
+	 * @param string $url Path to the config file.
+	 * @throws LoggerException
+	 */
+	private function load($url) {
+		if (!file_exists($url)) {
+			throw new LoggerException("File [$url] does not exist.");
+		}
+		
+		$properties = @parse_ini_file($url, true, INI_SCANNER_RAW);
+		if ($properties === false) {
+			$error = error_get_last();
+			throw new LoggerException("Error parsing configuration file: {$error['message']}");
+		}
+		
+		return $properties;
+	}
+	
+	/**
+	* Converts the provided INI configuration file to a PHP array config.
+	*
+	* @param string $path Path to the config file.
+	* @throws LoggerException If the file cannot be loaded or parsed.
+	*/
+	public function convert($path) {
+		// Load the configuration
+		$properties = $this->load($path);
+		
+		// Parse threshold
+		if (isset($properties[self::THRESHOLD_PREFIX])) {
+			$this->config['threshold'] = $properties[self::THRESHOLD_PREFIX]; 
+		}
+		
+		// Parse root logger
+		if (isset($properties[self::ROOT_LOGGER_PREFIX])) {
+			$this->parseLogger($properties[self::ROOT_LOGGER_PREFIX], self::ROOT_LOGGER_NAME);
+		}
+		
+		$appenders = array();
+		
+		foreach($properties as $key => $value) {
+			// Parse loggers
+			if ($this->beginsWith($key, self::LOGGER_PREFIX)) {
+				$name = substr($key, strlen(self::LOGGER_PREFIX));
+				$this->parseLogger($value, $name);
+			}
+			
+			// Parse additivity
+			if ($this->beginsWith($key, self::ADDITIVITY_PREFIX)) {
+				$name = substr($key, strlen(self::ADDITIVITY_PREFIX));
+				$this->config['loggers'][$name]['additivity'] = $value;
+			}
+			
+			// Parse appenders
+			else if ($this->beginsWith($key, self::APPENDER_PREFIX)) {
+				$this->parseAppender($key, $value);
+			}
+			
+			// Parse renderers
+			else if ($this->beginsWith($key, self::RENDERER_PREFIX)) {
+				$this->parseRenderer($key, $value);
+			}
+		}
+		
+		return $this->config;
+	}
+	
+	
+	/**
+	 * Parses a logger definition.
+	 * 
+	 * Loggers are defined in the following manner:
+	 * <pre>
+	 * log4php.logger.<name> = [<level>], [<appender-ref>, <appender-ref>, ...] 
+	 * </pre>
+	 * 
+	 * @param string $value The configuration value (level and appender-refs).
+	 * @param string $name Logger name. 
+	 */
+	private function parseLogger($value, $name) {
+		// Value is divided by commas
+		$parts = explode(',', $value);
+		if (empty($value) || empty($parts)) {
+			return;
+		}
+
+		// The first value is the logger level 
+		$level = array_shift($parts);
+		
+		// The remaining values are appender references 
+		$appenders = array();
+		while($appender = array_shift($parts)) {
+			$appender = trim($appender);
+			if (!empty($appender)) {
+				$appenders[] = trim($appender);
+			}
+		}
+
+		// Find the target configuration 
+		if ($name == self::ROOT_LOGGER_NAME) {
+			$this->config['rootLogger']['level'] = trim($level);
+			$this->config['rootLogger']['appenders'] = $appenders;
+		} else {
+			$this->config['loggers'][$name]['level'] = trim($level);
+			$this->config['loggers'][$name]['appenders'] = $appenders;
+		}
+	}
+	
+	/**
+	 * Parses an configuration line pertaining to an appender.
+	 * 
+	 * Parses the following patterns:
+	 * 
+	 * Appender class:
+	 * <pre>
+	 * log4php.appender.<name> = <class>
+	 * </pre>
+	 * 
+	 * Appender parameter:
+	 * <pre>
+	 * log4php.appender.<name>.<param> = <value>
+	 * </pre>
+	 * 
+ 	 * Appender threshold:
+	 * <pre>
+	 * log4php.appender.<name>.threshold = <level>
+	 * </pre>
+	 * 
+ 	 * Appender layout:
+	 * <pre>
+	 * log4php.appender.<name>.layout = <layoutClass>
+	 * </pre>
+	 * 
+	 * Layout parameter:
+	 * <pre>
+	 * log4php.appender.<name>.layout.<param> = <value>
+	 * </pre> 
+	 * 
+	 * For example, a full appender config might look like:
+	 * <pre>
+	 * log4php.appender.myAppender = LoggerAppenderConsole
+	 * log4php.appender.myAppender.threshold = info
+	 * log4php.appender.myAppender.target = stdout
+	 * log4php.appender.myAppender.layout = LoggerLayoutPattern
+	 * log4php.appender.myAppender.layout.conversionPattern = "%d %c: %m%n"
+	 * </pre>
+	 * 
+	 * After parsing all these options, the following configuration can be 
+	 * found under $this->config['appenders']['myAppender']:
+	 * <pre>
+	 * array(
+	 * 	'class' => LoggerAppenderConsole,
+	 * 	'threshold' => info,
+	 * 	'params' => array(
+	 * 		'target' => 'stdout'
+	 * 	),
+	 * 	'layout' => array(
+	 * 		'class' => 'LoggerAppenderConsole',
+	 * 		'params' => array(
+	 * 			'conversionPattern' => '%d %c: %m%n'
+	 * 		)
+	 * 	)
+	 * )
+	 * </pre>
+	 * 
+	 * @param string $key
+	 * @param string $value
+	 */
+	private function parseAppender($key, $value) {
+
+		// Remove the appender prefix from key
+		$subKey = substr($key, strlen(self::APPENDER_PREFIX));
+		
+		// Divide the string by dots
+		$parts = explode('.', $subKey);
+		$count = count($parts);
+		
+		// The first part is always the appender name
+		$name = trim($parts[0]);
+		
+		// Only one part - this line defines the appender class 
+		if ($count == 1) {
+			$this->config['appenders'][$name]['class'] = $value;
+			return;
+		}
+		
+		// Two parts - either a parameter, a threshold or layout class
+		else if ($count == 2) {
+			
+			if ($parts[1] == 'layout') {
+				$this->config['appenders'][$name]['layout']['class'] = $value;
+				return;
+			} else if ($parts[1] == 'threshold') {
+				$this->config['appenders'][$name]['threshold'] = $value;
+				return;
+			} else {
+				$this->config['appenders'][$name]['params'][$parts[1]] = $value;
+				return;
+			}
+		}
+		
+		// Three parts - this can only be a layout parameter
+		else if ($count == 3) {
+			if ($parts[1] == 'layout') {
+				$this->config['appenders'][$name]['layout']['params'][$parts[2]] = $value;
+				return;
+			}
+		}
+		
+		trigger_error("log4php: Don't know how to parse the following line: \"$key = $value\". Skipping.");
+	}
+
+	/**
+	 * Parses a renderer definition.
+	 * 
+	 * Renderers are defined as:
+	 * <pre>
+	 * log4php.renderer.<renderedClass> = <renderingClass> 
+	 * </pre>
+	 * 
+	 * @param string $key log4php.renderer.<renderedClass>
+	 * @param string $value <renderingClass>
+	 */
+	private function parseRenderer($key, $value) {
+		// Remove the appender prefix from key
+		$renderedClass = substr($key, strlen(self::APPENDER_PREFIX));
+		$renderingClass = $value;
+		
+		$this->config['renderers'][] = compact('renderedClass', 'renderingClass');
+	}
+	
+	/** Helper method. Returns true if $str begins with $sub. */
+	private function beginsWith($str, $sub) {
+		return (strncmp($str, $sub, strlen($sub)) == 0);
+	}
+	
+	
+}
+
+?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/configurators/LoggerConfigurationAdapterPHP.php b/libraries/log4php.debug/configurators/LoggerConfigurationAdapterPHP.php
new file mode 100644
index 000000000..91f5fc934
--- /dev/null
+++ b/libraries/log4php.debug/configurators/LoggerConfigurationAdapterPHP.php
@@ -0,0 +1,85 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * @package log4php
+ */
+
+/**
+ * Converts PHP configuration files to a PHP array.
+ * 
+ * The file should only hold the PHP config array preceded by "return".
+ * 
+ * Example PHP config file:
+ * <code>
+ * <?php
+ * return array(
+ *   'rootLogger' => array(
+ *     'level' => 'info',
+ *     'appenders' => array('default')
+ *   ),
+ *   'appenders' => array(
+ *     'default' => array(
+ *       'class' => 'LoggerAppenderEcho',
+ *       'layout' => array(
+ *       	'class' => 'LoggerLayoutSimple'
+ *        )
+ *     )
+ *   )
+ * )
+ * ?>
+ * </code>
+ * 
+ * @package log4php
+ * @subpackage configurators
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version $Revision$
+ * @since 2.2
+ */
+class LoggerConfigurationAdapterPHP implements LoggerConfigurationAdapter
+{
+	public function convert($url) {
+		if (!file_exists($url)) {
+			throw new LoggerException("File [$url] does not exist.");
+		}
+		
+		// Load the config file
+		$data = @file_get_contents($url);
+		if ($data === false) {
+			$error = error_get_last();
+			throw new LoggerException("Error loading config file: {$error['message']}");
+		}
+		
+		$config = @eval('?>' . $data);
+		
+		if ($config === false) {
+			$error = error_get_last();
+			throw new LoggerException("Error parsing configuration: " . $error['message']);
+		}
+		
+		if (empty($config)) {
+			throw new LoggerException("Invalid configuration: empty configuration array.");
+		}
+		
+		if (!is_array($config)) {
+			throw new LoggerException("Invalid configuration: not an array.");
+		}
+		
+		return $config;
+	}
+}
+
+?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/configurators/LoggerConfigurationAdapterXML.php b/libraries/log4php.debug/configurators/LoggerConfigurationAdapterXML.php
new file mode 100644
index 000000000..980692cac
--- /dev/null
+++ b/libraries/log4php.debug/configurators/LoggerConfigurationAdapterXML.php
@@ -0,0 +1,258 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ * @package log4php
+ */
+
+/**
+ * Converts XML configuration files to a PHP array.
+ * 
+ * @package log4php
+ * @subpackage configurators
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version $Revision$
+ * @since 2.2
+ */
+class LoggerConfigurationAdapterXML implements LoggerConfigurationAdapter
+{
+	/** Path to the XML schema used for validation. */
+	const SCHEMA_PATH = '/../xml/log4php.xsd';
+	
+	private $config = array(
+		'appenders' => array(),
+		'loggers' => array(),
+		'renderers' => array(),
+	);
+	
+	public function convert($url)
+	{
+		$xml = $this->loadXML($url);
+		
+		$this->parseConfiguration($xml);
+
+		// Parse the <root> node
+		if (isset($xml->root)) {		
+			$this->parseRootLogger($xml->root);
+		}
+		
+		// Process <logger> nodes
+		foreach($xml->logger as $logger) {
+			$this->parseLogger($logger);
+		} 
+		
+		// Process <appender> nodes
+		foreach($xml->appender as $appender) {
+			$this->parseAppender($appender);
+		}
+		
+		// Process <renderer> nodes
+		foreach($xml->renderer as $rendererNode) {
+			$this->parseRenderer($rendererNode);
+		}
+		return $this->config;
+	}
+	
+	/**
+	 * Loads and validates the XML.
+	 * @param string $url Input XML.
+	 */
+	private function loadXML($url) {
+		if (!file_exists($url)) {
+			throw new LoggerException("File [$url] does not exist.");
+		}
+
+		libxml_clear_errors();
+		$oldValue = libxml_use_internal_errors(true);
+		
+		// Load XML
+		$xml = @simplexml_load_file($url);
+		if ($xml === false) {
+			
+			$errorStr = "";
+			foreach(libxml_get_errors() as $error) {
+				$errorStr .= $error->message;
+			}
+			
+			throw new LoggerException("Error loading configuration file: " . trim($errorStr));
+		}
+		
+		libxml_clear_errors();
+		libxml_use_internal_errors($oldValue);
+		
+		return $xml;
+	}
+	
+	/**
+	 * Parses the <configuration> node.
+	 */
+	private function parseConfiguration(SimpleXMLElement $xml) {
+		$attributes = $xml->attributes();
+		if (isset($attributes['threshold'])) {
+			$this->config['threshold'] = (string) $attributes['threshold'];
+		}
+	}
+	
+	/** Parses an <appender> node. */
+	private function parseAppender(SimpleXMLElement $node) {
+		$name = $this->getAttributeValue($node, 'name');
+		if (empty($name)) {
+			$this->warn("An <appender> node is missing the required 'name' attribute. Skipping appender definition.");
+			return;
+		}
+		
+		$appender = array();
+		$appender['class'] = $this->getAttributeValue($node, 'class');
+		
+		if (isset($node['threshold'])) {
+			$appender['threshold'] = $this->getAttributeValue($node, 'threshold');
+		}
+		
+		if (isset($node->layout)) {
+			$appender['layout']= $this->parseLayout($node->layout, $name);
+		}
+		
+		if (count($node->param) > 0) {
+			$appender['params'] = $this->parseParameters($node);
+		}
+		
+		foreach($node->filter as $filterNode) {
+			$appender['filters'][] = $this->parseFilter($filterNode);
+		}
+		
+		$this->config['appenders'][$name] = $appender;
+	}
+	
+	/** Parses a <layout> node. */
+	private function parseLayout(SimpleXMLElement $node, $appenderName) {
+		$layout = array();
+		$layout['class'] = $this->getAttributeValue($node, 'class');
+		
+		if (count($node->param) > 0) {
+			$layout['params'] = $this->parseParameters($node);
+		}
+		
+		return $layout;
+	}

+	/** Parses any <param> child nodes returning them in an array. */
+	private function parseParameters($paramsNode) {
+		$params = array();
+
+		foreach($paramsNode->param as $paramNode) {
+			if (empty($paramNode['name'])) {
+				$this->warn("A <param> node is missing the required 'name' attribute. Skipping parameter.");
+				continue;
+			}
+			
+			$name = $this->getAttributeValue($paramNode, 'name');
+			$value = $this->getAttributeValue($paramNode, 'value');
+			
+			$params[$name] = $value;
+		}
+
+		return $params;
+	}
+	
+	/** Parses a <root> node. */
+	private function parseRootLogger(SimpleXMLElement $node) {
+		$logger = array();
+		
+		if (isset($node->level)) {
+			$logger['level'] = $this->getAttributeValue($node->level, 'value');
+		}
+		
+		$logger['appenders'] = array();
+		foreach($node->appender_ref as $appender) {
+			$logger['appenders'][] = $this->getAttributeValue($appender, 'ref');
+		}
+		
+		$this->config['rootLogger'] = $logger;
+	}
+	
+	/** Parses a <logger> node. */
+	private function parseLogger(SimpleXMLElement $node) {
+		$logger = array();
+		
+		$name = $this->getAttributeValue($node, 'name');
+		if (empty($name)) {
+			$this->warn("A <logger> node is missing the required 'name' attribute. Skipping logger definition.");
+			return;
+		}
+		
+		if (isset($node->level)) {
+			$logger['level'] = $this->getAttributeValue($node->level, 'value');
+		}
+		
+		if (isset($node['additivity'])) {
+			$logger['additivity'] = $this->getAttributeValue($node, 'additivity');
+		}
+		
+		$logger['appenders'] = $this->parseAppenderReferences($node, $name);
+
+		// Check for duplicate loggers
+		if (isset($this->config['loggers'][$name])) {
+			$this->warn("Duplicate logger definition [$name]. Overwriting.");
+		}
+		
+		$this->config['loggers'][$name] = $logger;
+	}
+	
+	/** 
+	 * Parses a <logger> node for appender references and returns them in an array.
+	 */
+	private function parseAppenderReferences(SimpleXMLElement $node, $name) {
+		$refs = array();
+		foreach($node->appender_ref as $ref) {
+			$refs[] = $this->getAttributeValue($ref, 'ref');
+		}
+		
+		return $refs;
+	}
+	
+	/** Parses a <filter> node. */
+	private function parseFilter($filterNode) {
+		$filter = array();
+		$filter['class'] = $this->getAttributeValue($filterNode, 'class');
+		
+		if (count($filterNode->param) > 0) {
+			$filter['params'] = $this->parseParameters($filterNode);
+		}
+		
+		return $filter;
+	}
+	
+	/** Parses a <renderer> node. */
+	private function parseRenderer(SimpleXMLElement $node) {
+		$renderedClass = $this->getAttributeValue($node, 'renderedClass');
+		$renderingClass = $this->getAttributeValue($node, 'renderingClass');
+		
+		$this->config['renderers'][] = compact('renderedClass', 'renderingClass');
+	}
+	
+	// ******************************************
+	// ** Helper methods                       **
+	// ******************************************
+	
+	private function getAttributeValue(SimpleXMLElement $node, $name) {
+		return isset($node[$name]) ? (string) $node[$name] : null;
+	}
+	
+	private function warn($message) {
+		trigger_error("log4php: " . $message, E_USER_WARNING);
+	}
+}
+
+?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/configurators/LoggerConfiguratorDefault.php b/libraries/log4php.debug/configurators/LoggerConfiguratorDefault.php
new file mode 100644
index 000000000..8ea21c8cf
--- /dev/null
+++ b/libraries/log4php.debug/configurators/LoggerConfiguratorDefault.php
@@ -0,0 +1,485 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @package log4php
+ */
+
+/**
+ * Default implementation of the logger configurator.
+ * 
+ * Configures log4php based on a provided configuration file or array.
+ * 
+ * @package log4php
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version $Revision: 1212319 $
+ * @since 2.2
+ */
+class LoggerConfiguratorDefault implements LoggerConfigurator
+{
+	/** XML configuration file format. */
+	const FORMAT_XML = 'xml';
+	
+	/** PHP configuration file format. */
+	const FORMAT_PHP = 'php';
+	
+	/** INI (properties) configuration file format. */
+	const FORMAT_INI = 'ini';
+
+	/** Defines which adapter should be used for parsing which format. */
+	private $adapters = array(
+		self::FORMAT_XML => 'LoggerConfigurationAdapterXML',
+		self::FORMAT_INI => 'LoggerConfigurationAdapterINI',
+		self::FORMAT_PHP => 'LoggerConfigurationAdapterPHP',
+	);
+	
+	/** Default configuration; used if no configuration file is provided. */
+	private static $defaultConfiguration = array(
+        'threshold' => 'ALL',
+        'rootLogger' => array(
+            'level' => 'DEBUG',
+            'appenders' => array('default'),
+        ),
+        'appenders' => array(
+            'default' => array(
+                'class' => 'LoggerAppenderEcho',
+                'layout' => array(
+                    'class' => 'LoggerLayoutTTCC',
+                ),
+            ),
+        ),
+	);
+	
+	/** Holds the appenders before they are linked to loggers. */
+	private $appenders = array();
+	
+	/**
+	 * Configures log4php based on the given configuration. The input can 
+	 * either be a path to the config file, or a PHP array holding the 
+	 * configuration. 
+	 * 
+	 * If no configuration is given, or if the given configuration cannot be
+	 * parsed for whatever reason, a warning will be issued, and log4php
+	 * will use the default configuration contained in 
+	 * {@link $defaultConfiguration}.
+	 * 
+	 * @param LoggerHierarchy $hierarchy The hierarchy on which to perform 
+	 * 		the configuration. 
+	 * @param string|array $input Either path to the config file or the 
+	 * 		configuration as an array. If not set, default configuration 
+	 * 		will be used.
+	 */
+	public function configure(LoggerHierarchy $hierarchy, $input = null) {
+		$config = $this->parse($input);
+		$this->doConfigure($hierarchy, $config);
+	}
+	
+	/**
+	 * Parses the given configuration and returns the parsed configuration
+	 * as a PHP array. Does not perform any configuration. 
+	 * 
+	 * If no configuration is given, or if the given configuration cannot be
+	 * parsed for whatever reason, a warning will be issued, and the default 
+	 * configuration will be returned ({@link $defaultConfiguration}).
+	 * 
+	 * @param string|array $input Either path to the config file or the 
+	 * 		configuration as an array. If not set, default configuration 
+	 * 		will be used.
+	 * @return array The parsed configuration.
+	 */
+	public function parse($input)
+	{
+		// No input - use default configuration
+		if (!isset($input)) {
+			$config = self::$defaultConfiguration;
+		}
+		
+		// Array input - contains configuration within the array
+		else if (is_array($input)) {
+			$config = $input;
+		}
+		
+		// String input - contains path to configuration file
+		else if (is_string($input)) {
+			try {
+				$config = $this->parseFile($input);
+			} catch (LoggerException $e) {
+				$this->warn("Configuration failed. " . $e->getMessage() . " Using default configuration.");
+				$config = self::$defaultConfiguration;
+			}
+		}
+		
+		// Anything else is an error
+		else {
+			$this->warn("Invalid configuration param given. Reverting to default configuration.");
+			$config = self::$defaultConfiguration;
+		}
+		
+		return $config;
+	}
+
+	/** 
+	 * Returns the default log4php configuration.
+	 * @return array
+	 */
+	public static function getDefaultConfiguration() {
+		return self::$defaultConfiguration;
+	} 
+	
+	/**
+	 * Loads the configuration file from the given URL, determines which
+	 * adapter to use, converts the configuration to a PHP array and
+	 * returns it.
+	 *
+	 * @param string $url Path to the config file.
+	 * @return The configuration from the config file, as a PHP array.
+	 * @throws LoggerException If the configuration file cannot be loaded, or
+	 * 		if the parsing fails.
+	 */
+	private function parseFile($url) {
+		
+		if (!file_exists($url)) {
+			throw new LoggerException("File not found at [$url].");
+		}
+		
+		$type = $this->getConfigType($url);
+		$adapterClass = $this->adapters[$type];
+
+		$adapter = new $adapterClass();
+		return $adapter->convert($url);
+	}
+	
+	/** Determines configuration file type based on the file extension. */
+	private function getConfigType($url) {
+		$info = pathinfo($url);
+		$ext = strtolower($info['extension']);
+		
+		switch($ext) {
+			case 'xml':
+				return self::FORMAT_XML;
+			
+			case 'ini':
+			case 'properties':
+				return self::FORMAT_INI;
+			
+			case 'php':
+				return self::FORMAT_PHP;
+				
+			default:
+				throw new LoggerException("Unsupported configuration file extension: $ext");
+		}
+	}
+	
+	/**
+	 * Constructs the logger hierarchy based on configuration.
+	 * 
+	 * @param LoggerHierarchy $hierarchy
+	 * @param array $config
+	 */
+	private function doConfigure(LoggerHierarchy $hierarchy, $config) {
+		if (isset($config['threshold'])) {
+			$threshold = LoggerLevel::toLevel($config['threshold']);
+			if (isset($threshold)) {
+				$hierarchy->setThreshold($threshold);
+			} else {
+				$this->warn("Invalid threshold value [{$config['threshold']}] specified. Ignoring threshold definition.");
+			}
+		}
+		
+		// Configure appenders and add them to the appender pool
+		if (isset($config['appenders']) && is_array($config['appenders'])) {
+			foreach($config['appenders'] as $name => $appenderConfig) {
+				$this->configureAppender($name, $appenderConfig);
+			}
+		}
+		
+		// Configure root logger 
+		if (isset($config['rootLogger'])) {
+			$this->configureRootLogger($hierarchy, $config['rootLogger']);
+		}
+		
+		// Configure loggers
+		if (isset($config['loggers']) && is_array($config['loggers'])) {
+			foreach($config['loggers'] as $loggerName => $loggerConfig) {
+				$this->configureOtherLogger($hierarchy, $loggerName, $loggerConfig);
+			}
+		}
+
+		// Configure renderers
+		if (isset($config['renderers']) && is_array($config['renderers'])) {
+			foreach($config['renderers'] as $rendererConfig) {
+				$this->configureRenderer($hierarchy, $rendererConfig);
+			}
+		}
+	}
+	
+	private function configureRenderer(LoggerHierarchy $hierarchy, $config) {
+		if (!isset($config['renderingClass'])) {
+			$this->warn("Rendering class not specified. Skipping renderers definition.");
+			return;			
+		}
+		
+		$renderingClass = $config['renderingClass'];
+		if (!class_exists($renderingClass)) {
+			$this->warn("Nonexistant rendering class [$renderingClass] specified. Skipping renderers definition.");
+			return;
+		}
+		
+		$renderingClassInstance = new $renderingClass();
+		if (!$renderingClassInstance instanceof LoggerRendererObject) {
+			$this->warn("Invalid class [$renderingClass] given. Not a valid LoggerRenderer class. Skipping renderers definition.");
+			return;			
+		}
+	
+		if (!isset($config['renderedClass'])) {
+			$this->warn("Rendered class not specified for rendering Class [$renderingClass]. Skipping renderers definition.");
+			return;			
+		}
+		
+		$renderedClass = $config['renderedClass'];
+		if (!class_exists($renderedClass)) {
+			$this->warn("Nonexistant rendered class [$renderedClass] specified for renderer [$renderingClass]. Skipping renderers definition.");
+			return;
+		}		
+
+		$hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClassInstance);
+	}
+	
+	/** 
+	 * Configures an appender based on given config and saves it to 
+	 * {@link $appenders} array so it can be later linked to loggers. 
+	 * @param string $name Appender name. 
+	 * @param array $config Appender configuration options.
+	 */
+	private function configureAppender($name, $config) {
+
+		// TODO: add this check to other places where it might be useful
+		if (!is_array($config)) {
+			$type = gettype($config);
+			$this->warn("Invalid configuration provided for appender [$name]. Expected an array, found <$type>. Skipping appender definition.");
+			return;
+		}
+		
+		// Parse appender class
+		$class = $config['class'];
+		if (empty($class)) {
+			$this->warn("No class given for appender [$name]. Skipping appender definition.");
+			return;
+		}
+		if (!class_exists($class)) {
+			$this->warn("Invalid class [$class] given for appender [$name]. Class does not exist. Skipping appender definition.");
+			return;
+		}
+		
+		// Instantiate the appender
+		$appender = new $class($name);
+		if (!($appender instanceof LoggerAppender)) {
+			$this->warn("Invalid class [$class] given for appender [$name]. Not a valid LoggerAppender class. Skipping appender definition.");
+			return;
+		}
+		
+		// Parse the appender threshold
+		if (isset($config['threshold'])) {
+			$threshold = LoggerLevel::toLevel($config['threshold']);
+			if ($threshold instanceof LoggerLevel) {
+				$appender->setThreshold($threshold);
+			} else {
+				$this->warn("Invalid threshold value [{$config['threshold']}] specified for appender [$name]. Ignoring threshold definition.");
+			}
+		}
+		
+		// Parse the appender layout
+		if ($appender->requiresLayout() && isset($config['layout'])) {
+			$this->createAppenderLayout($appender, $config['layout']);
+		}
+		
+		// Parse filters
+		if (isset($config['filters']) && is_array($config['filters'])) {
+			foreach($config['filters'] as $filterConfig) {
+				$this->createAppenderFilter($appender, $filterConfig);
+			}
+		}
+		
+		// Set options if any
+		if (isset($config['params'])) {
+			$this->setOptions($appender, $config['params']);
+		}
+
+		// Activate and save for later linking to loggers
+		$appender->activateOptions();
+		$this->appenders[$name] = $appender;
+	}
+	
+	/**
+	 * Parses layout config, creates the layout and links it to the appender.
+	 * @param LoggerAppender $appender
+	 * @param array $config Layout configuration.
+	 */
+	private function createAppenderLayout(LoggerAppender $appender, $config) {
+		$name = $appender->getName();
+		$class = $config['class'];
+		if (empty($class)) {
+			$this->warn("Layout class not specified for appender [$name]. Reverting to default layout.");
+			return;
+		}
+		if (!class_exists($class)) {
+			$this->warn("Nonexistant layout class [$class] specified for appender [$name]. Reverting to default layout.");
+			return;
+		}
+		
+		$layout = new $class();
+		if (!($layout instanceof LoggerLayout)) {
+			$this->warn("Invalid layout class [$class] sepcified for appender [$name]. Reverting to default layout.");
+			return;
+		}
+		
+		if (isset($config['params'])) {
+			$this->setOptions($layout, $config['params']);
+		}
+		
+		$layout->activateOptions();
+		$appender->setLayout($layout);
+	}
+	
+	/**
+	 * Parses filter config, creates the filter and adds it to the appender's 
+	 * filter chain.
+	 * @param LoggerAppender $appender
+	 * @param array $config Filter configuration.
+	 */
+	private function createAppenderFilter(LoggerAppender $appender, $config) {
+		$name = $appender->getName();
+		$class = $config['class'];
+		if (!class_exists($class)) {
+			$this->warn("Nonexistant filter class [$class] specified on appender [$name]. Skipping filter definition.");
+			return;
+		}
+	
+		$filter = new $class();
+		if (!($filter instanceof LoggerFilter)) {
+			$this->warn("Invalid filter class [$class] sepcified on appender [$name]. Skipping filter definition.");
+			return;
+		}
+	
+		if (isset($config['params'])) {
+			$this->setOptions($filter, $config['params']);
+		}
+	
+		$filter->activateOptions();
+		$appender->addFilter($filter);
+	}
+	
+	/** 
+	 * Configures the root logger
+	 * @see configureLogger() 
+	 */
+	private function configureRootLogger(LoggerHierarchy $hierarchy, $config) {
+		$logger = $hierarchy->getRootLogger();
+		$this->configureLogger($logger, $config);
+	}
+
+	/**
+	 * Configures a logger which is not root.
+	 * @see configureLogger()
+	 */
+	private function configureOtherLogger(LoggerHierarchy $hierarchy, $name, $config) {
+		// Get logger from hierarchy (this creates it if it doesn't already exist)
+		$logger = $hierarchy->getLogger($name);
+		$this->configureLogger($logger, $config);
+	}
+	
+	/**
+	 * Configures a logger. 
+	 * 
+	 * @param Logger $logger The logger to configure
+	 * @param array $config Logger configuration options.
+	 */
+	private function configureLogger(Logger $logger, $config) {
+		$loggerName = $logger->getName();
+		
+		// Set logger level
+		if (isset($config['level'])) {
+			$level = LoggerLevel::toLevel($config['level']);
+			if (isset($level)) {
+				$logger->setLevel($level);
+			} else {
+				$default = $logger->getLevel();
+				$this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName]. Ignoring level definition.");
+			}
+		}
+		
+		// Link appenders to logger
+		if (isset($config['appenders'])) {
+			foreach($config['appenders'] as $appenderName) {
+				if (isset($this->appenders[$appenderName])) {
+					$logger->addAppender($this->appenders[$appenderName]);
+				} else {
+					$this->warn("Nonexistnant appender [$appenderName] linked to logger [$loggerName].");
+				}
+			}
+		}
+		
+		// Set logger additivity
+		if (isset($config['additivity'])) {
+			$additivity = LoggerOptionConverter::toBoolean($config['additivity'], null);
+			if (is_bool($additivity)) {
+				$logger->setAdditivity($additivity);
+			} else {
+				$this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [$loggerName]. Ignoring additivity setting.");
+			}
+		}
+	}
+
+	/**
+	 * Helper method which applies given options to an object which has setters
+	 * for these options (such as appenders, layouts, etc.).
+	 * 
+	 * For example, if options are:
+	 * <code>
+	 * array(
+	 * 	'file' => '/tmp/myfile.log',
+	 * 	'append' => true
+	 * )
+	 * </code>
+	 * 
+	 * This method will call:
+	 * <code>
+	 * $object->setFile('/tmp/myfile.log')
+	 * $object->setAppend(true)
+	 * </code>
+	 * 
+	 * If required setters do not exist, it will produce a warning. 
+	 * 
+	 * @param mixed $object The object to configure.
+	 * @param unknown_type $options
+	 */
+	private function setOptions($object, $options) {
+		foreach($options as $name => $value) {
+			$setter = "set$name";
+			if (method_exists($object, $setter)) {
+				$object->$setter($value);
+			} else {
+				$class = get_class($object);
+				$this->warn("Nonexistant option [$name] specified on [$class]. Skipping.");
+			}
+		}
+	}
+	
+	/** Helper method to simplify error reporting. */
+	private function warn($message) {
+		trigger_error("log4php: $message", E_USER_WARNING);
+	}
+}
\ No newline at end of file
diff --git a/libraries/log4php.debug/configurators/LoggerConfiguratorIni.php b/libraries/log4php.debug/configurators/LoggerConfiguratorIni.php
deleted file mode 100644
index 7d009b89c..000000000
--- a/libraries/log4php.debug/configurators/LoggerConfiguratorIni.php
+++ /dev/null
@@ -1,463 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @package log4php
- */
-
-/**
- * Allows the configuration of log4php from an external file.
- * 
- * <p>This is the most commonly used method of configuring log4php.</p>
- * 
- * <p>It is sometimes useful to see how log4php is reading configuration
- * files. You can enable log4php internal logging by defining the
- * <b>log4php.debug</b> variable.</p>
- *
- * <p>The <i>LoggerConfiguratorIni</i> does not handle the
- * advanced configuration features supported by the {@link LoggerConfiguratorXml} 
- * such as support for {@link LoggerFilter}, 
- * custom {@link LoggerErrorHandlers}, nested appenders such as the {@link Logger AsyncAppender}, 
- * etc.</p>
- * 
- * <p>All option <i>values</i> admit variable substitution. The
- * syntax of variable substitution is similar to that of Unix
- * shells. The string between an opening <b>"${"</b> and
- * closing <b>"}"</b> is interpreted as a key. The value of
- * the substituted variable can be defined as a system property or in
- * the configuration file itself. The value of the key is first
- * searched in the defined constants, in the enviroments variables
- * and if not found there, it is
- * then searched in the configuration file being parsed.  The
- * corresponding value replaces the ${variableName} sequence.</p>
- * <p>For example, if <b>$_ENV['home']</b> env var is set to
- * <b>/home/xyz</b>, then every occurrence of the sequence
- * <b>${home}</b> will be interpreted as
- * <b>/home/xyz</b>. See {@link LoggerOptionConverter::getSystemProperty()}
- * for details.</p>
- *
- * <p>An example how to use this appender:</p>
- *
- * {@example ../../examples/php/appender_dailyfile.php 19}
- *
- * <p>And the corresponding ini file:</p>
- *
- * {@example ../../examples/resources/appender_dailyfile.properties 18}
- *
- * @version $Revision: 1071033 $
- * @package log4php
- * @subpackage configurators
- * @since 0.5
- */
-class LoggerConfiguratorIni implements LoggerConfigurator {
- 	const CATEGORY_PREFIX = "log4php.category.";
- 	const LOGGER_PREFIX = "log4php.logger.";
-	const FACTORY_PREFIX = "log4php.factory";
-	const ADDITIVITY_PREFIX = "log4php.additivity.";
-	const ROOT_CATEGORY_PREFIX = "log4php.rootCategory";
-	const ROOT_LOGGER_PREFIX = "log4php.rootLogger";
-	const APPENDER_PREFIX = "log4php.appender.";
-	const RENDERER_PREFIX = "log4php.renderer.";
-	const THRESHOLD_PREFIX = "log4php.threshold";
-	
-	/** 
-	 * Key for specifying the {@link LoggerFactory}.  
-	 */
-	const LOGGER_FACTORY_KEY = "log4php.loggerFactory";
-	const LOGGER_DEBUG_KEY = "log4php.debug";
-	const INTERNAL_ROOT_NAME = "root";
-	
-	/**
-	 * Constructor
-	 */
-	public function __construct() {
-	}
-
-	/**
-	 * Read configuration from a file.
-	 *
-	 * <p>The function {@link PHP_MANUAL#parse_ini_file} is used to read the
-	 * file.</p>
-	 *
-	 * <b>The existing configuration is not cleared nor reset.</b> 
-	 * If you require a different behavior, then call 
-	 * {@link  Logger::resetConfiguration()} 
-	 * method before calling {@link doConfigure()}.
-	 * 
-	 * <p>The configuration file consists of statements in the format
-	 * <b>key=value</b>. The syntax of different configuration
-	 * elements are discussed below.
-	 * 
-	 * <p><b>Repository-wide threshold</b></p>
-	 * 
-	 * <p>The repository-wide threshold filters logging requests by level
-	 * regardless of logger. The syntax is:
-	 * 
-	 * <pre>
-	 * log4php.threshold=[level]
-	 * </pre>
-	 * 
-	 * <p>The level value can consist of the string values OFF, FATAL,
-	 * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
-	 * custom level value can be specified in the form
-	 * <samp>level#classname</samp>. By default the repository-wide threshold is set
-	 * to the lowest possible value, namely the level <b>ALL</b>.
-	 * </p>
-	 * 
-	 * 
-	 * <p><b>Appender configuration</b></p>
-	 * 
-	 * <p>Appender configuration syntax is:</p>
-	 * <pre>
-	 * ; For appender named <i>appenderName</i>, set its class.
-	 * ; Note: The appender name can contain dots.
-	 * log4php.appender.appenderName=name_of_appender_class
-	 * 
-	 * ; Set appender specific options.
-	 * 
-	 * log4php.appender.appenderName.option1=value1
-	 * log4php.appender.appenderName.optionN=valueN
-	 * </pre>
-	 * 
-	 * For each named appender you can configure its {@link LoggerLayout}. The
-	 * syntax for configuring an appender's layout is:
-	 * <pre>
-	 * log4php.appender.appenderName.layout=name_of_layout_class
-	 * log4php.appender.appenderName.layout.option1=value1
-	 *	....
-	 * log4php.appender.appenderName.layout.optionN=valueN
-	 * </pre>
-	 * 
-	 * <p><b>Configuring loggers</b></p>
-	 * 
-	 * <p>The syntax for configuring the root logger is:
-	 * <pre>
-	 * log4php.rootLogger=[level], appenderName, appenderName, ...
-	 * </pre>
-	 * 
-	 * <p>This syntax means that an optional <i>level</i> can be
-	 * supplied followed by appender names separated by commas.
-	 * 
-	 * <p>The level value can consist of the string values OFF, FATAL,
-	 * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
-	 * custom level value can be specified in the form</p>
-	 *
-	 * <pre>level#classname</pre>
-	 * 
-	 * <p>If a level value is specified, then the root level is set
-	 * to the corresponding level.	If no level value is specified,
-	 * then the root level remains untouched.
-	 * 
-	 * <p>The root logger can be assigned multiple appenders.
-	 * 
-	 * <p>Each <i>appenderName</i> (separated by commas) will be added to
-	 * the root logger. The named appender is defined using the
-	 * appender syntax defined above.
-	 * 
-	 * <p>For non-root categories the syntax is almost the same:
-	 * <pre>
-	 * log4php.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName, ...
-	 * </pre>
-	 * 
-	 * <p>The meaning of the optional level value is discussed above
-	 * in relation to the root logger. In addition however, the value
-	 * INHERITED can be specified meaning that the named logger should
-	 * inherit its level from the logger hierarchy.</p>
-	 * 
-	 * <p>If no level value is supplied, then the level of the
-	 * named logger remains untouched.</p>
-	 * 
-	 * <p>By default categories inherit their level from the
-	 * hierarchy. However, if you set the level of a logger and later
-	 * decide that that logger should inherit its level, then you should
-	 * specify INHERITED as the value for the level value. NULL is a
-	 * synonym for INHERITED.</p>
-	 * 
-	 * <p>Similar to the root logger syntax, each <i>appenderName</i>
-	 * (separated by commas) will be attached to the named logger.</p>
-	 * 
-	 * <p>See the <i>appender additivity rule</i> in the user manual for 
-	 * the meaning of the <b>additivity</b> flag.
-	 * 
-	 * <p><b>ObjectRenderers</b></p>
-	 * 
-	 * <p>You can customize the way message objects of a given type are
-	 * converted to String before being logged. This is done by
-	 * specifying a {@link LoggerRendererObject}
-	 * for the object type would like to customize.</p>
-	 * 
-	 * <p>The syntax is:
-	 * 
-	 * <pre>
-	 * log4php.renderer.name_of_rendered_class=name_of_rendering.class
-	 * </pre>
-	 * 
-	 * As in,
-	 * <pre>
-	 * log4php.renderer.myFruit=myFruitRenderer
-	 * </pre>
-	 * 
-	 * <p><b>Logger Factories</b></p>
-	 * 
-	 * The usage of custom logger factories is discouraged and no longer
-	 * documented.
-	 * 
-	 * <p><b>Example</b></p>
-	 * 
-	 * <p>An example configuration is given below. Other configuration
-	 * file examples are given in the <b>tests</b> folder.
-	 * 
-	 * <pre>
-	 * ; Set options for appender named "A1".
-	 * ; Appender "A1" will be a LoggerAppenderSyslog
-	 * log4php.appender.A1=LoggerAppenderSyslog
-	 * 
-	 * ; The syslog daemon resides on www.abc.net
-	 * log4php.appender.A1.ident=log4php-test
-	 * 
-	 * ; A1's layout is a LoggerPatternLayout, using the conversion pattern
-	 * ; <b>%r %-5p %c{2} %M.%L %x - %m%n</b>. Thus, the log output will
-	 * ; include the relative time since the start of the application in
-	 * ; milliseconds, followed by the level of the log request,
-	 * ; followed by the two rightmost components of the logger name,
-	 * ; followed by the callers method name, followed by the line number,
-	 * ; the nested disgnostic context and finally the message itself.
-	 * ; Refer to the documentation of LoggerPatternLayout} for further information
-	 * ; on the syntax of the ConversionPattern key.
-	 * log4php.appender.A1.layout=LoggerPatternLayout
-	 * log4php.appender.A1.layout.ConversionPattern="%-4r %-5p %c{2} %M.%L %x - %m%n"
-	 * 
-	 * ; Set options for appender named "A2"
-	 * ; A2 should be a LoggerAppenderRollingFile, with maximum file size of 10 MB
-	 * ; using at most one backup file. A2's layout is TTCC, using the
-	 * ; ISO8061 date format with context printing enabled.
-	 * log4php.appender.A2=LoggerAppenderRollingFile
-	 * log4php.appender.A2.MaxFileSize=10MB
-	 * log4php.appender.A2.MaxBackupIndex=1
-	 * log4php.appender.A2.layout=LoggerLayoutTTCC
-	 * log4php.appender.A2.layout.ContextPrinting="true"
-	 * log4php.appender.A2.layout.DateFormat="%c"
-	 * 
-	 * ; Root logger set to DEBUG using the A2 appender defined above.
-	 * log4php.rootLogger=DEBUG, A2
-	 * 
-	 * ; Logger definitions:
-	 * ; The SECURITY logger inherits is level from root. However, it's output
-	 * ; will go to A1 appender defined above. It's additivity is non-cumulative.
-	 * log4php.logger.SECURITY=INHERIT, A1
-	 * log4php.additivity.SECURITY=false
-	 * 
-	 * ; Only warnings or above will be logged for the logger "SECURITY.access".
-	 * ; Output will go to A1.
-	 * log4php.logger.SECURITY.access=WARN
-	 * 
-	 * 
-	 * ; The logger "class.of.the.day" inherits its level from the
-	 * ; logger hierarchy.	Output will go to the appender's of the root
-	 * ; logger, A2 in this case.
-	 * log4php.logger.class.of.the.day=INHERIT
-	 * </pre>
-	 * 
-	 * <p>Refer to the <b>setOption</b> method in each Appender and
-	 * Layout for class specific options.</p>
-	 * 
-	 * <p>Use the <b>&quot;;&quot;</b> character at the
-	 * beginning of a line for comments.</p>
-	 * 
-	 * @param string $url The name of the configuration file where the
-	 *					  configuration information is stored.
-	 * @param LoggerHierarchy $repository the repository to apply the configuration
-	 */
-	public function configure(LoggerHierarchy $hierarchy, $url = '') {
-		$properties = @parse_ini_file($url);
-		if ($properties === false) {
-			$error = error_get_last();
-			throw new LoggerException("LoggerConfiguratorIni: Error parsing configuration file: ".$error['message']);
-		}
-		if  (count($properties) == 0) {
-			trigger_error("LoggerConfiguratorIni: Configuration file is empty.", E_USER_WARNING);
-		}
-		
-		return $this->doConfigureProperties($properties, $hierarchy);
-	}
-
-	/**
-	 * Read configuration options from <b>properties</b>.
-	 *
-	 * @see doConfigure().
-	 * @param array $properties
-	 * @param LoggerHierarchy $hierarchy
-	 */
-	private function doConfigureProperties($properties, LoggerHierarchy $hierarchy) {
-		$thresholdStr = @$properties[self::THRESHOLD_PREFIX];
-		$hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
-		$this->configureRootCategory($properties, $hierarchy);
-		$this->parseCatsAndRenderers($properties, $hierarchy);
-		return true;
-	}
-
-	/**
-	 * @param array $props array of properties
-	 * @param LoggerHierarchy $hierarchy
-	 */
-	private function configureRootCategory($props, LoggerHierarchy $hierarchy) {
-		$effectivePrefix = self::ROOT_LOGGER_PREFIX;
-		$value = @$props[self::ROOT_LOGGER_PREFIX];
-
-		if(empty($value)) {
-			$value = @$props[self::ROOT_CATEGORY_PREFIX];
-			$effectivePrefix = self::ROOT_CATEGORY_PREFIX;
-		}
-
-		if(empty($value)) {
-			// TODO "Could not find root logger information. Is this OK?"
-		} else {
-			$root = $hierarchy->getRootLogger();
-			$this->parseCategory($props, $root, $effectivePrefix, self::INTERNAL_ROOT_NAME,	$value);
-		}
-	}
-
-	/**
-	 * Parse non-root elements, such non-root categories and renderers.
-	 *
-	 * @param array $props array of properties
-	 * @param LoggerHierarchy $hierarchy
-	 */
-	private function parseCatsAndRenderers($props, LoggerHierarchy $hierarchy) {
-		while(list($key,$value) = each($props)) {
-			if(strpos($key, self::CATEGORY_PREFIX) === 0 or 
-				strpos($key, self::LOGGER_PREFIX) === 0) {
-				if(strpos($key, self::CATEGORY_PREFIX) === 0) {
-					$loggerName = substr($key, strlen(self::CATEGORY_PREFIX));
-				} else if(strpos($key, self::LOGGER_PREFIX) === 0) {
-					$loggerName = substr($key, strlen(self::LOGGER_PREFIX));
-				}
-				
-				$logger = $hierarchy->getLogger($loggerName);
-				$this->parseCategory($props, $logger, $key, $loggerName, $value);
-				$this->parseAdditivityForLogger($props, $logger, $loggerName);
-			} else if(strpos($key, self::RENDERER_PREFIX) === 0) {
-				$renderedClass = substr($key, strlen(self::RENDERER_PREFIX));
-				$renderingClass = $value;
-				$hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClass);
-			}
-		}
-	}
-
-	/**
-	 * Parse the additivity option for a non-root category.
-	 *
-	 * @param array $props array of properties
-	 * @param Logger $cat
-	 * @param string $loggerName
-	 */
-	private function parseAdditivityForLogger($props, Logger $cat, $loggerName) {
-		$value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX . $loggerName, $props);
-		$additivity = LoggerOptionConverter::toBoolean($value, true);
-		$cat->setAdditivity($additivity);
-	}
-
-	/**
-	 * This method must work for the root category as well.
-	 *
-	 * @param array $props array of properties
-	 * @param Logger $logger
-	 * @param string $optionKey
-	 * @param string $loggerName
-	 * @param string $value
-	 * @return Logger
-	 */
-	private function parseCategory($props, Logger $logger, $optionKey, $loggerName, $value) {
-		// We must skip over ',' but not white space
-		$st = explode(',', $value);
-
-		// If value is not in the form ", appender.." or "", then we should set
-		// the level of the loggeregory.
-
-		if(!(empty($value) || @$value[0] == ',')) {
-			// just to be on the safe side...
-			if(count($st) == 0) {
-				return;
-			}
-			$levelStr = current($st);
-			
-			// If the level value is inherited, set category level value to
-			// null. We also check that the user has not specified inherited for the
-			// root category.
-			if('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
-				if($loggerName == self::INTERNAL_ROOT_NAME) {
-					// TODO: throw exception?	"The root logger cannot be set to null."
-				} else {
-					$logger->setLevel(null);
-				}
-			} else {
-				$logger->setLevel(LoggerOptionConverter::toLevel($levelStr, LoggerLevel::getLevelDebug()));
-			}
-		}
-
-		// TODO: removing should be done by the logger, if necessary and wanted 
-		// $logger->removeAllAppenders();
-		while($appenderName = next($st)) {
-			$appenderName = trim($appenderName);
-			if(empty($appenderName)) {
-				continue;
-			}
-			
-			$appender = $this->parseAppender($props, $appenderName);
-			if($appender !== null) {
-					$logger->addAppender($appender);
-			}
-		}
-	}
-
-	/**
-	 * @param array $props array of properties
-	 * @param string $appenderName
-	 * @return LoggerAppender
-	 */
-	private function parseAppender($props, $appenderName) {
-		$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
-		$prefix = self::APPENDER_PREFIX . $appenderName;
-		if($appender === null) {
-			// Appender was not previously initialized.
-			$appenderClass = @$props[$prefix];
-			$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderClass);
-			if($appender === null) {
-				return null;
-			}
-		}
-		
-		if($appender->requiresLayout() ) {
-			$layoutPrefix = $prefix . ".layout";
-			$layoutClass = @$props[$layoutPrefix];
-			$layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
-			if(empty($layoutClass)) {
-				$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
-			} else {
-				$layout = LoggerReflectionUtils::createObject($layoutClass);
-				if($layout === null) {
-					$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
-				}
-			}
-			
-			LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix . ".");
-			$appender->setLayout($layout);
-			
-		}
-		LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix . ".");
-		return $appender;
-	}
-}
diff --git a/libraries/log4php.debug/configurators/LoggerConfiguratorPhp.php b/libraries/log4php.debug/configurators/LoggerConfiguratorPhp.php
deleted file mode 100644
index d25fa579c..000000000
--- a/libraries/log4php.debug/configurators/LoggerConfiguratorPhp.php
+++ /dev/null
@@ -1,159 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @package log4php
- */
-
-/**
- * LoggerConfiguratorPhp class
- *
- * This class allows configuration of log4php through a PHP array or an external file that
- * returns a PHP array. If you use the PHP array option, you can simply give an array instead
- * of an URL parameter.
- *
- * An example for this configurator is:
- *
- * {@example ../../examples/php/configurator_php.php 19}
- * 
- * Which includes the following snippet:
- * 
- * {@example ../../examples/resources/configurator_php.php 18}
- *
- * @package log4php
- * @subpackage configurators
- * @since 2.0
- */
-class LoggerConfiguratorPhp implements LoggerConfigurator {
-	
-	public function configure(LoggerHierarchy $hierarchy, $url = '') {
-		return $this->doConfigure($url, $hierarchy);
-	}
-	
-	private function doConfigure($url, LoggerHierarchy $hierarchy) {
-		if (!is_array($url)) {
- 			$config = require $url;
- 		} else {
- 			$config = $url;
- 		}
-		
-		// set threshold
-		if(isset($config['threshold'])) {
-			$hierarchy->setThreshold(LoggerOptionConverter::toLevel($config['threshold'], LoggerLevel::getLevelAll()));
-		}
-
-		// add renderes
-		if (isset($config['renderers'])) {
-			foreach ($config['renderers'] as $renderedClass => $renderingClass) {
-				$hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClass);
-			}
-		}
-		
-		// parse and create appenders
-		if(isset($config['appenders'])) {
-			
-			foreach($config['appenders'] as $appenderName => $appenderProperties) {
-				
-				$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderProperties['class']);
-				
-				// unset so that the property wont be drawn up again
-				unset($appenderProperties['class']);
-				
-				if($appender->requiresLayout()) {
-					
-					if(isset($appenderProperties['layout'])) {
-						
-						if(isset($appenderProperties['layout']['class']) and !empty($appenderProperties['layout']['class'])) {
-							$layoutClass = $appenderProperties['layout']['class'];
-						} else {
-							$layoutClass = 'LoggerLayoutSimple';
-						}
-						
-						$layout = LoggerReflectionUtils::createObject($layoutClass);
-						if($layout === null) {
-							$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
-						}
-						
-						if(isset($appenderProperties['file']) && method_exists($appender, 'setFileName')) { 
- 						    $appender->setFile($appenderProperties['file'], true); 
-						}
-						
-						if($layout instanceof LoggerLayoutPattern) {
-							$layout->setConversionPattern($appenderProperties['layout']['conversionPattern']);
-						}
-						
-						$appender->setLayout($layout);
-						
-						// unset so that the property wont be drawn up again
-						unset($appenderProperties['layout']);
-					} else {
-						// TODO: throw exception?
-					}
-					
-				}
-				// set remaining properties and activate appender
-				$setter = new LoggerReflectionUtils($appender);
-				foreach ($appenderProperties as $key => $val) {
-					$setter->setProperty($key, $val);
- 				}
-				$setter->activate();
-			}
-			
-		}
-		
-		// parse and create root logger
-		if(isset($config['rootLogger'])) {
-			$rootLogger = $hierarchy->getRootLogger();
-			if(isset($config['rootLogger']['level'])) {
-				$rootLogger->setLevel(LoggerOptionConverter::toLevel($config['rootLogger']['level'], LoggerLevel::getLevelDebug()));
-				if(isset($config['rootLogger']['appenders'])) {
-					foreach($config['rootLogger']['appenders'] as $appenderName) {
-						$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
-						if($appender !== null) {
-							$rootLogger->addAppender($appender);
-						}
-					}
-				}	
-			}
-		}
-		
-		// parse and create loggers
-		if(isset($config['loggers'])) {
-			foreach($config['loggers'] as $loggerName => $loggerProperties) {
-				if(is_string($loggerName)) {
-					$logger = $hierarchy->getLogger($loggerName);
-					
-					if(isset($loggerProperties['level'])) {
-						$logger->setLevel(LoggerOptionConverter::toLevel($loggerProperties['level'], LoggerLevel::getLevelDebug()));
-						if(isset($loggerProperties['appenders'])) {
-							foreach($loggerProperties['appenders'] as $appenderName) {
-								$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
-								if($appender !== null) {
-									$logger->addAppender($appender);
-								}
-							}
-						}	
-					}
-				} else {
-					// TODO: throw exception
-				}
-			}
-		}
-		
-		return true;
-	}
-	
-}
diff --git a/libraries/log4php.debug/configurators/LoggerConfiguratorXml.php b/libraries/log4php.debug/configurators/LoggerConfiguratorXml.php
deleted file mode 100644
index 58947f78b..000000000
--- a/libraries/log4php.debug/configurators/LoggerConfiguratorXml.php
+++ /dev/null
@@ -1,441 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @package log4php
- */
-
-/**
- * Use this class to initialize the log4php environment using XML files.
- *
- * <p>Read the log4php.dtd included in the documentation directory. Note that
- * php parser does not validate the document.</p>
- *
- * <p>Sometimes it is useful to see how log4php is reading configuration
- * files. You can enable log4php internal logging by setting the <var>debug</var> 
- * attribute in the <var>log4php:configuration</var> element.</p>
- *
- * <p>An example for this configurator:</p>
- * 
- * {@example ../../examples/php/configurator_xml.php 19}<br>
- * 
- * <p>The corresponding XML file:</p>
- * 
- * {@example ../../examples/resources/configurator_xml.xml 18}
- * 
- * <p>There are more sample XML files included in the package under tests/ subdirectories.</p>
- *
- * @version $Revision: 1059292 $
- * @package log4php
- * @subpackage configurators
- * @since 0.4 
- */
-class LoggerConfiguratorXml implements LoggerConfigurator {
-	const APPENDER_STATE = 1000;
-	const LAYOUT_STATE = 1010;
-	const ROOT_STATE = 1020;
-	const LOGGER_STATE = 1030;
-	const FILTER_STATE = 1040;
-	
-	const DEFAULT_FILENAME = './log4php.xml';
-	
-	/**
-	 * @var string the default configuration document
-	 */
-	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>
-	</log4php:configuration>';
-	
-	/**
-	 * @var string the elements namespace
-	 */
-	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;
-
-		$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;
-		}
-	}
-
-
-	/**
-	 * @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);
-	}
-
-}
diff --git a/libraries/log4php.debug/filters/LoggerFilterLevelMatch.php b/libraries/log4php.debug/filters/LoggerFilterLevelMatch.php
index 02dbadc9d..8ea456feb 100644
--- a/libraries/log4php.debug/filters/LoggerFilterLevelMatch.php
+++ b/libraries/log4php.debug/filters/LoggerFilterLevelMatch.php
@@ -40,7 +40,7 @@
  * 
  * {@example ../../examples/resources/filter_levelmatch.xml 18}
  * 
- * @version $Revision: 1059292 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage filters
  * @since 0.6
@@ -51,30 +51,26 @@ class LoggerFilterLevelMatch extends LoggerFilter {
 	 * Indicates if this event should be accepted or denied on match
 	 * @var boolean
 	 */
-	private $acceptOnMatch = true;
+	protected $acceptOnMatch = true;
 
 	/**
 	 * The level, when to match
 	 * @var LoggerLevel
 	 */
-	private $levelToMatch;
+	protected $levelToMatch;
   
 	/**
 	 * @param boolean $acceptOnMatch
 	 */
 	public function setAcceptOnMatch($acceptOnMatch) {
-		$this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
+		$this->setBoolean('acceptOnMatch', $acceptOnMatch);
 	}
 	
 	/**
 	 * @param string $l the level to match
 	 */
-	public function setLevelToMatch($l) {
-		if($l instanceof LoggerLevel) {
-			$this->levelToMatch = $l;
-		} else {
-			$this->levelToMatch = LoggerOptionConverter::toLevel($l, null);
-		}
+	public function setLevelToMatch($level) {
+		$this->setLevel('levelToMatch', $level);
 	}
 
 	/**
diff --git a/libraries/log4php.debug/filters/LoggerFilterLevelRange.php b/libraries/log4php.debug/filters/LoggerFilterLevelRange.php
index b9083a642..dbdc4ed33 100644
--- a/libraries/log4php.debug/filters/LoggerFilterLevelRange.php
+++ b/libraries/log4php.debug/filters/LoggerFilterLevelRange.php
@@ -57,7 +57,7 @@
  * @author Simon Kitching
  * @author based on the org.apache.log4j.varia.LevelRangeFilte Java code by Ceki G&uuml;lc&uuml; 
  *
- * @version $Revision: 1059292 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage filters
  * @since 0.6
@@ -67,45 +67,37 @@ class LoggerFilterLevelRange extends LoggerFilter {
 	/**
 	 * @var boolean
 	 */
-	private $acceptOnMatch = true;
+	protected $acceptOnMatch = true;
 
 	/**
 	 * @var LoggerLevel
 	 */
-	private $levelMin;
+	protected $levelMin;
   
 	/**
 	 * @var LoggerLevel
 	 */
-	private $levelMax;
+	protected $levelMax;
 
 	/**
 	 * @param boolean $acceptOnMatch
 	 */
 	public function setAcceptOnMatch($acceptOnMatch) {
-		$this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
+		$this->setBoolean('acceptOnMatch', $acceptOnMatch); 
 	}
 	
 	/**
 	 * @param string $l the level min to match
 	 */
-	public function setLevelMin($l) {
-		if($l instanceof LoggerLevel) {
-			$this->levelMin = $l;
-		} else {
-			$this->levelMin = LoggerOptionConverter::toLevel($l, null);
-		}
+	public function setLevelMin($level) {
+		$this->setLevel('levelMin', $level);
 	}
 
 	/**
 	 * @param string $l the level max to match
 	 */
-	public function setLevelMax($l) {
-		if($l instanceof LoggerLevel) {
-			$this->levelMax = $l;
-		} else {
-			$this->levelMax = LoggerOptionConverter::toLevel($l, null);
-		}
+	public function setLevelMax($level) {
+		$this->setLevel('levelMax', $level);
 	}
 
 	/**
diff --git a/libraries/log4php.debug/filters/LoggerFilterStringMatch.php b/libraries/log4php.debug/filters/LoggerFilterStringMatch.php
index 35c4fa586..3787caa20 100644
--- a/libraries/log4php.debug/filters/LoggerFilterStringMatch.php
+++ b/libraries/log4php.debug/filters/LoggerFilterStringMatch.php
@@ -40,7 +40,7 @@
  * 
  * {@example ../../examples/resources/filter_stringmatch.xml 18}
  *
- * @version $Revision: 883108 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage filters
  * @since 0.3
@@ -50,25 +50,25 @@ class LoggerFilterStringMatch extends LoggerFilter {
 	/**
 	 * @var boolean
 	 */
-	private $acceptOnMatch = true;
+	protected $acceptOnMatch = true;
 
 	/**
 	 * @var string
 	 */
-	private $stringToMatch = null;
+	protected $stringToMatch;
 
 	/**
 	 * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false')
 	 */
 	public function setAcceptOnMatch($acceptOnMatch) {
-		$this->acceptOnMatch = is_bool($acceptOnMatch) ? $acceptOnMatch : (bool)(strtolower($acceptOnMatch) == 'true');
+		$this->setBoolean('acceptOnMatch', $acceptOnMatch);
 	}
 	
 	/**
 	 * @param string $s the string to match
 	 */
-	public function setStringToMatch($s) {
-		$this->stringToMatch = $s;
+	public function setStringToMatch($string) {
+		$this->setString('stringToMatch', $string);
 	}
 
 	/**
diff --git a/libraries/log4php.debug/helpers/LoggerNamedPatternConverter.php b/libraries/log4php.debug/helpers/LoggerNamedPatternConverter.php
index 087ec0a63..eda3326c8 100644
--- a/libraries/log4php.debug/helpers/LoggerNamedPatternConverter.php
+++ b/libraries/log4php.debug/helpers/LoggerNamedPatternConverter.php
@@ -21,7 +21,6 @@
 /**
  * @package log4php
  * @subpackage helpers
- * @abstract
  */
 class LoggerNamedPatternConverter extends LoggerPatternConverter {
 
@@ -44,10 +43,8 @@ class LoggerNamedPatternConverter extends LoggerPatternConverter {
 	/**
 	 * @param LoggerLoggingEvent $event
 	 * @return string
-	 * @abstract
 	 */
 	public function getFullyQualifiedName($event) {
-		// abstract
 		return;
 	}
 
@@ -60,6 +57,9 @@ class LoggerNamedPatternConverter extends LoggerPatternConverter {
 		if($this->precision <= 0) {
 			return $n;
 		} else {
+			
+			// TODO: do this with explode()
+			
 			$len = strlen($n);
 			// We substract 1 from 'len' when assigning to 'end' to avoid out of
 			// bounds exception in return r.substring(end+1, len). This can happen if
diff --git a/libraries/log4php.debug/helpers/LoggerOptionConverter.php b/libraries/log4php.debug/helpers/LoggerOptionConverter.php
index dec46746c..b32007688 100644
--- a/libraries/log4php.debug/helpers/LoggerOptionConverter.php
+++ b/libraries/log4php.debug/helpers/LoggerOptionConverter.php
@@ -21,10 +21,9 @@
 /**
  * A convenience class to convert property values to specific types.
  *
- * @version $Revision: 1059292 $ 
+ * @version $Revision: 1213283 $ 
  * @package log4php
  * @subpackage helpers
- * @static
  * @since 0.5
  */
 class LoggerOptionConverter {
@@ -33,7 +32,13 @@ class LoggerOptionConverter {
 	const DELIM_STOP = '}';
 	const DELIM_START_LEN = 2;
 	const DELIM_STOP_LEN = 1;
-
+	
+	/** String values which are converted to boolean TRUE. */
+	private static $trueValues = array('1', 'true', 'yes', 'on');
+	
+	/** String values which are converted to boolean FALSE. */
+	private static $falseValues = array('0', 'false', 'no', 'off');
+	
 	/**
 	 * Read a predefined var.
 	 *
@@ -46,8 +51,6 @@ class LoggerOptionConverter {
 	 * @param string $def The default value to return.
 	 * @return string	the string value of the system property, or the default
 	 *					value if there is no property with that key.
-	 *
-	 * @static
 	 */
 	public static function getSystemProperty($key, $def) {
 		if(defined($key)) {
@@ -72,8 +75,6 @@ class LoggerOptionConverter {
 	 * @param string $value
 	 * @param boolean $default
 	 * @return boolean
-	 *
-	 * @static
 	 */
 	public static function toBoolean($value, $default=true) {
 		if (is_null($value)) {
@@ -91,15 +92,31 @@ class LoggerOptionConverter {
 			return !($value == 0); // true is everything but 0 like in C 
 		}
 		
-		trigger_error("Could not convert ".var_export($value,1)." to boolean!", E_USER_WARNING);
 		return $default;
 	}
 
+	/** Converts $value to boolean, or throws an exception if not possible. */
+	public static function toBooleanEx($value) {
+		if (isset($value)) {
+			if (is_bool($value)) {
+				return $value;
+			}
+			$value = strtolower(trim($value));
+			if (in_array($value, self::$trueValues)) {
+				return true;
+			}
+			if (in_array($value, self::$falseValues)) {
+				return false;
+			}
+		}
+		
+		throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to boolean.");
+	}
+	
 	/**
 	 * @param string $value
 	 * @param integer $default
 	 * @return integer
-	 * @static
 	 */
 	public static function toInt($value, $default) {
 		$value = trim($value);
@@ -109,6 +126,37 @@ class LoggerOptionConverter {
 			return $default;
 		}
 	}
+	
+	
+	/** 
+	 * Converts $value to integer, or throws an exception if not possible. 
+	 * Floats cannot be converted to integer.
+	 */
+	public static function toIntegerEx($value) {
+		if (is_integer($value)) {
+			return $value;
+		}
+		if (is_numeric($value) && ($value == (integer) $value)) {
+			return (integer) $value;
+		}
+	
+		throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to integer.");
+	}
+	
+	/**
+	 * Converts $value to integer, or throws an exception if not possible.
+	 * Floats cannot be converted to integer.
+	 */
+	public static function toPositiveIntegerEx($value) {
+		if (is_integer($value) && $value > 0) {
+			return $value;
+		}
+		if (is_numeric($value) && ($value == (integer) $value) && $value > 0) {
+			return (integer) $value;
+		}
+	
+		throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a positive integer.");
+	}
 
 	/**
 	 * Converts a standard or custom priority level to a Level
@@ -135,7 +183,6 @@ class LoggerOptionConverter {
 	 * @param string $value
 	 * @param LoggerLevel $defaultValue
 	 * @return LoggerLevel a {@link LoggerLevel} or null
-	 * @static
 	 */
 	public static function toLevel($value, $defaultValue) {
 		if($value === null) {
@@ -171,13 +218,24 @@ class LoggerOptionConverter {
 		} 
 		return $result;
 	}
+	
+	
+	/** Converts the value to a level. Throws an exception if not possible. */
+	public static function toLevelEx($value) {
+		if ($value instanceof LoggerLevel) {
+			return $value;
+		}
+		$level = LoggerLevel::toLevel($value);
+		if ($level === null) {
+			throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a logger level.");
+		}
+		return $level;
+	}
 
 	/**
 	 * @param string $value
 	 * @param float $default
 	 * @return float
-	 *
-	 * @static
 	 */
 	public static function toFileSize($value, $default) {
 		if($value === null) {
@@ -201,7 +259,79 @@ class LoggerOptionConverter {
 		} 
 		return $default;
 	}
+	
+
+	/**
+	 * Converts a value to a valid file size (integer).
+	 * 
+	 * Supports 'KB', 'MB' and 'GB' suffixes, where KB = 1024 B etc. 
+	 *
+	 * The final value will be rounded to the nearest integer.
+	 *
+	 * Examples:
+	 * - '100' => 100
+	 * - '100.12' => 100
+	 * - '100KB' => 102400
+	 * - '1.5MB' => 1572864
+	 * 
+	 * @param mixed $value File size (optionally with suffix).
+	 * @return integer Parsed file size.
+	 */
+	public static function toFileSizeEx($value) {
+		
+		if (empty($value)) {
+			throw new LoggerException("Empty value cannot be converted to a file size.");
+		}
+		
+		if (is_numeric($value)) {
+			return (integer) $value;
+		}
+		
+		if (!is_string($value)) {
+			throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to a file size.");
+		}
+		
+		$str = strtoupper(trim($value));
+		$count = preg_match('/^([0-9.]+)(KB|MB|GB)?$/', $str, $matches);
+		
+		if ($count > 0) {
+			$size = $matches[1];
+			$unit = $matches[2];
+			
+			switch($unit) {
+				case 'KB': $size *= pow(1024, 1); break;
+				case 'MB': $size *= pow(1024, 2); break;
+				case 'GB': $size *= pow(1024, 3); break;
+			}
+			
+			return (integer) $size;
+		}
+		
+		throw new LoggerException("Given value [$value] cannot be converted to a file size.");
+	}
 
+	/** 
+	 * Converts a value to string, or throws an exception if not possible. 
+	 * 
+	 * Objects can be converted to string if they implement the magic 
+	 * __toString() method.
+	 * 
+	 */
+	public static function toStringEx($value) {
+		if (is_string($value)) {
+			return $value;
+		}
+		if (is_numeric($value)) {
+			return (string) $value;
+		}
+		if (is_object($value) && method_exists($value, '__toString')) {
+			return (string) $value;
+		}
+	
+		throw new LoggerException("Given value [" . var_export($value, true) . "] cannot be converted to string.");
+	}
+	
+	
 	/**
 	 * Find the value corresponding to <var>$key</var> in
 	 * <var>$props</var>. Then perform variable substitution on the
@@ -210,8 +340,6 @@ class LoggerOptionConverter {
 	 * @param string $key
 	 * @param array $props
 	 * @return string
-	 *
-	 * @static
 	 */
 	public static function findAndSubst($key, $props) {
 		$value = @$props[$key];
@@ -267,8 +395,6 @@ class LoggerOptionConverter {
 	 * @param string $val The string on which variable substitution is performed.
 	 * @param array $props
 	 * @return string
-	 *
-	 * @static
 	 */
 	 // TODO: this method doesn't work correctly with key = true, it needs key = "true" which is odd
 	public static function substVars($val, $props = null) {
diff --git a/libraries/log4php.debug/helpers/LoggerPatternConverter.php b/libraries/log4php.debug/helpers/LoggerPatternConverter.php
index 6a047e89e..1bf951e5f 100644
--- a/libraries/log4php.debug/helpers/LoggerPatternConverter.php
+++ b/libraries/log4php.debug/helpers/LoggerPatternConverter.php
@@ -27,10 +27,9 @@
  * individual PatternConverters. Each of which is responsible for
  * converting a logging event in a converter specific manner.</p>
  * 
- * @version $Revision: 925973 $
+ * @version $Revision: 1166187 $
  * @package log4php
  * @subpackage helpers
- * @abstract
  * @since 0.3
  */
 class LoggerPatternConverter {
diff --git a/libraries/log4php.debug/helpers/LoggerPatternParser.php b/libraries/log4php.debug/helpers/LoggerPatternParser.php
index 912b24d1a..cb0406898 100644
--- a/libraries/log4php.debug/helpers/LoggerPatternParser.php
+++ b/libraries/log4php.debug/helpers/LoggerPatternParser.php
@@ -25,7 +25,7 @@
  * <p>It is this class that parses conversion patterns and creates
  * a chained list of {@link LoggerPatternConverter} converters.</p>
  * 
- * @version $Revision: 948675 $ 
+ * @version $Revision: 1163520 $ 
  * @package log4php
  * @subpackage helpers
  *
@@ -302,16 +302,6 @@ class LoggerPatternParser {
 				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::THREAD_CONVERTER);
 				$this->currentLiteral = '';
 				break;
-			case 'u':
-				if($this->i < $this->patternLength) {
-					$cNext = $this->pattern{$this->i};
-					if(ord($cNext) >= ord('0') and ord($cNext) <= ord('9')) {
-						$pc = new LoggerUserFieldPatternConverter($this->formattingInfo, (string)(ord($cNext) - ord('0')));
-						$this->currentLiteral = '';
-						$this->i++;
-					}
-				}
-				break;
 			case 'x':
 				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::NDC_CONVERTER);
 				$this->currentLiteral = '';
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutHtml.php b/libraries/log4php.debug/layouts/LoggerLayoutHtml.php
index b58ddd172..3f9df87b6 100644
--- a/libraries/log4php.debug/layouts/LoggerLayoutHtml.php
+++ b/libraries/log4php.debug/layouts/LoggerLayoutHtml.php
@@ -42,12 +42,11 @@
  *    0    8318   INFO  root       Hello World!
  * </pre>
  * 
- * @version $Revision: 1059292 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage layouts
  */
 class LoggerLayoutHtml extends LoggerLayout {
-
 	/**
 	 * The <b>LocationInfo</b> option takes a boolean value. By
 	 * default, it is set to false which means there will be no location
@@ -60,7 +59,7 @@ class LoggerLayoutHtml extends LoggerLayout {
 	 * <b>LocationInfo</b> option of that appender as well.
 	 * @var boolean
 	 */
-	private $locationInfo = false;
+	protected $locationInfo = false;
 	
 	/**
 	 * The <b>Title</b> option takes a String value. This option sets the
@@ -68,13 +67,7 @@ class LoggerLayoutHtml extends LoggerLayout {
 	 * Defaults to 'Log4php Log Messages'.
 	 * @var string
 	 */
-	private $title = "Log4php Log Messages";
-	
-	/**
-	 * Constructor
-	 */
-	public function __construct() {
-	}
+	protected $title = "Log4php Log Messages";
 	
 	/**
 	 * The <b>LocationInfo</b> option takes a boolean value. By
@@ -88,11 +81,7 @@ class LoggerLayoutHtml extends LoggerLayout {
 	 * <b>LocationInfo</b> option of that appender as well.
 	 */
 	public function setLocationInfo($flag) {
-		if (is_bool($flag)) {
-			$this->locationInfo = $flag;
-		} else {
-			$this->locationInfo = (bool)(strtolower($flag) == 'true');
-		}
+		$this->setBoolean('locationInfo', $flag);
 	}
 
 	/**
@@ -108,7 +97,7 @@ class LoggerLayoutHtml extends LoggerLayout {
 	 * Defaults to 'Log4php Log Messages'.
 	 */
 	public function setTitle($title) {
-		$this->title = $title;
+		$this->setString('title', $title);
 	}
 
 	/**
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutPattern.php b/libraries/log4php.debug/layouts/LoggerLayoutPattern.php
index 6d6d35e1d..4125f5ae3 100644
--- a/libraries/log4php.debug/layouts/LoggerLayoutPattern.php
+++ b/libraries/log4php.debug/layouts/LoggerLayoutPattern.php
@@ -130,7 +130,7 @@
  *                                                                then truncate from the beginning.  
  * </pre>
  * 
- * @version $Revision: 1059292 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage layouts
  * @since 0.3 
@@ -140,30 +140,16 @@ class LoggerLayoutPattern extends LoggerLayout {
 	const DEFAULT_CONVERSION_PATTERN = '%m%n';
 
 	/** Default conversion TTCC Pattern */
-	const TTCC_CONVERSION_PATTERN = '%r [%t] %p %c %x - %m%n';
+	const TTCC_CONVERSION_PATTERN = '%d [%t] %p %c %x - %m%n';
 
-	/** The pattern. 
-	 * @var string */
-	private $pattern;
+	/** The conversion pattern. */ 
+	protected $pattern = self::DEFAULT_CONVERSION_PATTERN;
 
-	/** Head of a chain of Converters.
-	 * @var LoggerPatternConverter */
-	private $head;
-
-	private $timezone;
-
-	/**
-	 * Constructs a PatternLayout using the 
-	 * {@link DEFAULT_LAYOUT_PATTERN}.
-	 * The default pattern just produces the application supplied message.
+	/** 
+	 * Head of a chain of Converters.
+	 * @var LoggerPatternConverter 
 	 */
-	public function __construct($pattern = null) {
-		if ($pattern === null) {
-			$this->setConversionPattern(self::DEFAULT_CONVERSION_PATTERN);
-		} else {
-			$this->pattern = $pattern;
-		}
-	}
+	private $head;
 
 	/**
 	 * Set the <b>ConversionPattern</b> option. This is the string which
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutSerialized.php b/libraries/log4php.debug/layouts/LoggerLayoutSerialized.php
new file mode 100644
index 000000000..7b2da0658
--- /dev/null
+++ b/libraries/log4php.debug/layouts/LoggerLayoutSerialized.php
@@ -0,0 +1,55 @@
+<?php
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @package log4php
+ */
+
+/**
+ * Layout which formats the events using PHP's serialize() function.
+ * 
+ * Available options:
+ * - locationInfo - If set to true, the event's location information will also
+ *                  be serialized (slow, defaults to false).
+ * 
+ * @version $Revision: 1059292 $
+ * @package log4php
+ * @subpackage layouts
+ * @since 2.2
+ */  
+class LoggerLayoutSerialized extends LoggerLayout {
+	
+	/** Whether to include the event's location information (slow). */
+	protected $locationInfo = false;
+	
+	/** Sets the location information flag. */
+	public function setLocationInfo($value) {
+		$this->setBoolean('locationInfo', $value);
+	}
+	
+	/** Returns the location information flag. */
+	public function getLocationInfo() {
+		return $this->locationInfo;
+	}
+	
+	public function format(LoggerLoggingEvent $event) {
+		// If required, initialize the location data
+		if($this->locationInfo) {
+			$event->getLocationInformation();
+		}
+		return serialize($event) . PHP_EOL;
+	}
+}
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutSimple.php b/libraries/log4php.debug/layouts/LoggerLayoutSimple.php
index 8c716e651..8f552a958 100644
--- a/libraries/log4php.debug/layouts/LoggerLayoutSimple.php
+++ b/libraries/log4php.debug/layouts/LoggerLayoutSimple.php
@@ -34,17 +34,11 @@
  * 
  * <samp>INFO - Hello World!</samp>
  *
- * @version $Revision: 1059292 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage layouts
  */  
 class LoggerLayoutSimple extends LoggerLayout {
-	/**
-	 * Constructor
-	 */
-	public function __construct() {
-	}
-
 	/**
 	 * Returns the log statement in a format consisting of the
 	 * <b>level</b>, followed by " - " and then the
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutTTCC.php b/libraries/log4php.debug/layouts/LoggerLayoutTTCC.php
index 0aa58c482..027d54d70 100644
--- a/libraries/log4php.debug/layouts/LoggerLayoutTTCC.php
+++ b/libraries/log4php.debug/layouts/LoggerLayoutTTCC.php
@@ -44,7 +44,7 @@
  * The above would print:<br>
  * <samp>02:28 [13714] INFO root - Hello World!</samp>
  *
- * @version $Revision: 1136787 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage layouts
  */
@@ -79,9 +79,7 @@ class LoggerLayoutTTCC extends LoggerLayout {
 	 * current thread is part of log output or not. This is true by default.
 	 */
 	public function setThreadPrinting($threadPrinting) {
-		$this->threadPrinting = is_bool($threadPrinting) ? 
-			$threadPrinting : 
-			(bool)(strtolower($threadPrinting) == 'true'); 
+		$this->setBoolean('threadPrinting', $threadPrinting);
 	}
 
 	/**
@@ -96,7 +94,7 @@ class LoggerLayoutTTCC extends LoggerLayout {
 	 * name is part of log output or not. This is true by default.
 	 */
 	public function setCategoryPrefixing($categoryPrefixing) {
-		$this->categoryPrefixing = LoggerOptionConverter::toBoolean($categoryPrefixing);
+		$this->setBoolean('categoryPrefixing', $categoryPrefixing);
 	}
 
 	/**
@@ -112,7 +110,7 @@ class LoggerLayoutTTCC extends LoggerLayout {
 	 * This is true by default.
 	 */
 	public function setContextPrinting($contextPrinting) {
-		$this->contextPrinting = LoggerOptionConverter::toBoolean($contextPrinting); 
+		$this->setBoolean('contextPrinting', $contextPrinting);
 	}
 
 	/**
@@ -128,9 +126,7 @@ class LoggerLayoutTTCC extends LoggerLayout {
 	 * This is true by default.
 	 */
 	public function setMicroSecondsPrinting($microSecondsPrinting) {
-		$this->microSecondsPrinting = is_bool($microSecondsPrinting) ? 
-			$microSecondsPrinting : 
-			(bool)(strtolower($microSecondsPrinting) == 'true'); 
+		$this->setBoolean('microSecondsPrinting', $microSecondsPrinting);
 	}
 
 	/**
@@ -142,7 +138,7 @@ class LoggerLayoutTTCC extends LoggerLayout {
 	
 	
 	public function setDateFormat($dateFormat) {
-		$this->dateFormat = $dateFormat;
+		$this->setString('dateFormat', $dateFormat);
 	}
 	
 	/**
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutXml.php b/libraries/log4php.debug/layouts/LoggerLayoutXml.php
index 88244a36f..9b4e15727 100644
--- a/libraries/log4php.debug/layouts/LoggerLayoutXml.php
+++ b/libraries/log4php.debug/layouts/LoggerLayoutXml.php
@@ -21,8 +21,13 @@
 /**
  * The output of the LoggerXmlLayout consists of a series of log4php:event elements. 
  * 
- * <p>Parameters: {@link $locationInfo}.</p>
- *
+ * Configurable parameters: 
+ * - {@link $locationInfo} - If set to true then the file name and line number 
+ *   of the origin of the log statement will be included in output.
+ * - {@link $log4jNamespace} - If set to true then log4j namespace will be used
+ *   instead of log4php namespace. This can be usefull when using log viewers 
+ *   which can only parse the log4j namespace such as Apache Chainsaw. 
+ * 
  * <p>It does not output a complete well-formed XML file. 
  * The output is designed to be included as an external entity in a separate file to form
  * a correct XML file.</p>
@@ -44,7 +49,7 @@
  * </log4php:eventSet>
  * </pre>
  *
- * @version $Revision: 1059292 $
+ * @version $Revision: 1213283 $
  * @package log4php
  * @subpackage layouts
  */
@@ -58,45 +63,35 @@ class LoggerLayoutXml extends LoggerLayout {
 	const CDATA_START = '<![CDATA[';
 	const CDATA_END = ']]>';
 	const CDATA_PSEUDO_END = ']]&gt;';
-
 	const CDATA_EMBEDDED_END = ']]>]]&gt;<![CDATA[';
 
 	/**
 	 * If set to true then the file name and line number of the origin of the
 	 * log statement will be output.
-	 * 
 	 * @var boolean
 	 */
-	private $locationInfo = true;
+	protected $locationInfo = true;
   
 	/**
-	 * @var boolean set the elements namespace
+	 * If set to true, log4j namespace will be used instead of the log4php 
+	 * namespace.
+	 * @var boolean 
 	 */
-	private $log4jNamespace = false;
+	protected $log4jNamespace = false;
 	
+	/** The namespace in use. */
+	protected $namespace = self::LOG4PHP_NS;
 	
-	/**
-	 * @var string namespace
-	 * @private
-	 */
-	private $_namespace = self::LOG4PHP_NS;
-	
-	/**
-	 * @var string namespace prefix
-	 * @private
-	 */
-	private $_namespacePrefix = self::LOG4PHP_NS_PREFIX;
+	/** The namespace prefix in use */
+	protected $namespacePrefix = self::LOG4PHP_NS_PREFIX;
 	 
-	/** 
-	 * No options to activate. 
-	 */
 	public function activateOptions() {
 		if ($this->getLog4jNamespace()) {
-			$this->_namespace        = self::LOG4J_NS;
-			$this->_namespacePrefix  = self::LOG4J_NS_PREFIX;
+			$this->namespace        = self::LOG4J_NS;
+			$this->namespacePrefix  = self::LOG4J_NS_PREFIX;
 		} else {
-			$this->_namespace        = self::LOG4PHP_NS;
-			$this->_namespacePrefix  = self::LOG4PHP_NS_PREFIX;
+			$this->namespace        = self::LOG4PHP_NS;
+			$this->namespacePrefix  = self::LOG4PHP_NS_PREFIX;
 		}
 	}
 	
@@ -104,11 +99,11 @@ class LoggerLayoutXml extends LoggerLayout {
 	 * @return string
 	 */
 	public function getHeader() {
-		return "<{$this->_namespacePrefix}:eventSet ".
-					"xmlns:{$this->_namespacePrefix}=\"{$this->_namespace}\" ".
-					"version=\"0.3\" ".
-					"includesLocationInfo=\"".($this->getLocationInfo() ? "true" : "false")."\"".
-					">\r\n";
+		return "<{$this->namespacePrefix}:eventSet ".
+			"xmlns:{$this->namespacePrefix}=\"{$this->namespace}\" ".
+			"version=\"0.3\" ".
+			"includesLocationInfo=\"".($this->getLocationInfo() ? "true" : "false")."\"".
+			">" . PHP_EOL;
 	}
 
 	/**
@@ -118,51 +113,59 @@ class LoggerLayoutXml extends LoggerLayout {
 	 * @return string
 	 */
 	public function format(LoggerLoggingEvent $event) {
+		$ns = $this->namespacePrefix;
+		
 		$loggerName = $event->getLoggerName();
-		$timeStamp  = number_format((float)($event->getTimeStamp() * 1000), 0, '', '');
-		$thread     = $event->getThreadName();
-		$level      = $event->getLevel();
-		$levelStr   = $level->toString();
+		$timeStamp = number_format((float)($event->getTimeStamp() * 1000), 0, '', '');
+		$thread = $event->getThreadName();
+		$level = $event->getLevel()->toString();
 
-		$buf = "<{$this->_namespacePrefix}:event logger=\"{$loggerName}\" level=\"{$levelStr}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">".PHP_EOL;
-		$buf .= "<{$this->_namespacePrefix}:message><![CDATA["; 
-		$this->appendEscapingCDATA($buf, $event->getRenderedMessage()); 
-		$buf .= "]]></{$this->_namespacePrefix}:message>".PHP_EOL;
+		$buf  = "<$ns:event logger=\"{$loggerName}\" level=\"{$level}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">".PHP_EOL;
+		$buf .= "<$ns:message>"; 
+		$buf .= $this->encodeCDATA($event->getRenderedMessage()); 
+		$buf .= "</$ns:message>".PHP_EOL;
 
 		$ndc = $event->getNDC();
-		if($ndc != null) {
-			$buf .= "<{$this->_namespacePrefix}:NDC><![CDATA[";
-			$this->appendEscapingCDATA($buf, $ndc);
-			$buf .= "]]></{$this->_namespacePrefix}:NDC>".PHP_EOL;
+		if(!empty($ndc)) {
+			$buf .= "<$ns:NDC><![CDATA[";
+			$buf .= $this->encodeCDATA($ndc);
+			$buf .= "]]></$ns:NDC>".PHP_EOL;
+		}
+		
+		$mdcMap = $event->getMDCMap();
+		if (!empty($mdcMap)) {
+			$buf .= "<$ns:properties>".PHP_EOL;
+			foreach ($mdcMap as $name=>$value) {
+				$buf .= "<$ns:data name=\"$name\" value=\"$value\" />".PHP_EOL;
+			}
+			$buf .= "</$ns:properties>".PHP_EOL;
 		}
 
 		if ($this->getLocationInfo()) {
 			$locationInfo = $event->getLocationInformation();
-			$buf .= "<{$this->_namespacePrefix}:locationInfo ". 
+			$buf .= "<$ns:locationInfo ". 
 					"class=\"" . $locationInfo->getClassName() . "\" ".
 					"file=\"" .  htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" ".
 					"line=\"" .  $locationInfo->getLineNumber() . "\" ".
 					"method=\"" . $locationInfo->getMethodName() . "\" ";
 			$buf .= "/>".PHP_EOL;
-
 		}
 
-		$buf .= "</{$this->_namespacePrefix}:event>".PHP_EOL.PHP_EOL;
+		$buf .= "</$ns:event>".PHP_EOL;
 		
 		return $buf;
-
 	}
 	
 	/**
 	 * @return string
 	 */
 	public function getFooter() {
-		return "</{$this->_namespacePrefix}:eventSet>\r\n";
+		return "</{$this->namespacePrefix}:eventSet>" . PHP_EOL;
 	}
 	
 	
-	/** Whether or not file name and line number will be included in the output.
-	 * 
+	/** 
+	 * Whether or not file name and line number will be included in the output.
 	 * @return boolean
 	 */
 	public function getLocationInfo() {
@@ -177,7 +180,7 @@ class LoggerLayoutXml extends LoggerLayout {
 	 * origin of the log statement will be output.
 	 */
 	public function setLocationInfo($flag) {
-		$this->locationInfo = LoggerOptionConverter::toBoolean($flag, true);
+		$this->setBoolean('locationInfo', $flag);
 	}
   
 	/**
@@ -191,32 +194,17 @@ class LoggerLayoutXml extends LoggerLayout {
 	 * @param boolean
 	 */
 	public function setLog4jNamespace($flag) {
-		$this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, true);
+		$this->setBoolean('log4jNamespace', $flag);
 	}
 	
-	/**
-	 * Ensures that embeded CDEnd strings (]]&gt;) are handled properly
-	 * within message, NDC and throwable tag text.
-	 *
-	 * @param string $buf	String holding the XML data to this point.	The
-	 *						initial CDStart (<![CDATA[) and final CDEnd (]]>) 
-	 *						of the CDATA section are the responsibility of 
-	 *						the calling method.
-	 * @param string str	The String that is inserted into an existing 
-	 *						CDATA Section within buf.
-	 * @static  
+	/** 
+	 * Encases a string in CDATA tags, and escapes any existing CDATA end 
+	 * tags already present in the string.
+	 * @param string $string 
 	 */
-	private function appendEscapingCDATA(&$buf, $str) {
-		if(empty($str)) {
-			return;
-		}
-	
-		$rStr = str_replace(
-			self::CDATA_END,
-			self::CDATA_EMBEDDED_END,
-			$str
-		);
-		$buf .= $rStr;
+	private function encodeCDATA($string) {
+		$string = str_replace(self::CDATA_END, self::CDATA_EMBEDDED_END, $string);
+		return self::CDATA_START . $string . self::CDATA_END;
 	}
 }
 
diff --git a/libraries/log4php.debug/renderers/LoggerRendererMap.php b/libraries/log4php.debug/renderers/LoggerRendererMap.php
index c6ed4efb1..980503f4c 100644
--- a/libraries/log4php.debug/renderers/LoggerRendererMap.php
+++ b/libraries/log4php.debug/renderers/LoggerRendererMap.php
@@ -29,7 +29,7 @@
  * DEBUG - Doe, John
  * </pre>
  * 
- * @version $Revision: 1125335 $
+ * @version $Revision: 1166187 $
  * @package log4php
  * @subpackage renderers
  * @since 0.3
@@ -61,7 +61,6 @@ class LoggerRendererMap {
 	 * @param LoggerHierarchy $repository a logger repository.
 	 * @param string $renderedClassName
 	 * @param string $renderingClassName
-	 * @static
 	 */
 	public function addRenderer($renderedClassName, $renderingClassName) {
 		$renderer = LoggerReflectionUtils::createObject($renderingClassName);
-- 
GitLab