From fd1129ea35cdcc7a8f2cb78fb6cfa148fd20a088 Mon Sep 17 00:00:00 2001
From: Uma <uma.s@vtiger.com>
Date: Mon, 25 Jan 2021 15:22:07 +0530
Subject: [PATCH] log4php library upgraded version 2.0

---
 SendSupportNotification.php                   |   2 +-
 cron/SendReminder.service                     |   2 +-
 .../SalesOrder/RecurringInvoice.service       |   2 +-
 data/Tracker.php                              |   2 +-
 include/database/PearDatabase.php             |   8 +-
 include/logging.php                           |  10 +-
 include/utils/export.php                      |   2 +-
 libraries/log4php.debug/Logger.php            | 662 +++++++++++++++--
 libraries/log4php.debug/LoggerAppender.php    | 437 +++++++-----
 .../log4php.debug/LoggerAppenderPool.php      |  55 ++
 .../log4php.debug/LoggerAppenderSkeleton.php  | 355 ---------
 .../log4php.debug/LoggerBasicConfigurator.php |  80 ---
 libraries/log4php.debug/LoggerCategory.php    | 572 ---------------
 .../log4php.debug/LoggerConfigurator.php      |  53 ++
 .../LoggerDefaultCategoryFactory.php          |  52 --
 libraries/log4php.debug/LoggerException.php   |  28 +
 libraries/log4php.debug/LoggerFilter.php      | 126 ++++
 libraries/log4php.debug/LoggerHierarchy.php   | 569 ++++++---------
 libraries/log4php.debug/LoggerLayout.php      | 134 ++--
 libraries/log4php.debug/LoggerLevel.php       | 448 ++++++------
 .../log4php.debug/LoggerLocationInfo.php      | 110 +++
 libraries/log4php.debug/LoggerLog.php         |  99 ---
 .../log4php.debug/LoggerLoggingEvent.php      | 360 ++++++++++
 libraries/log4php.debug/LoggerMDC.php         | 192 +++--
 libraries/log4php.debug/LoggerManager.php     | 262 -------
 libraries/log4php.debug/LoggerNDC.php         | 347 +++++----
 .../LoggerPropertyConfigurator.php            | 650 -----------------
 .../log4php.debug/LoggerReflectionUtils.php   | 154 ++++
 libraries/log4php.debug/LoggerRoot.php        | 138 ++--
 .../appenders/LoggerAppenderAdodb.php         | 263 +++++++
 .../appenders/LoggerAppenderConsole.php       | 204 +++---
 .../appenders/LoggerAppenderDailyFile.php     | 153 ++--
 .../appenders/LoggerAppenderDb.php            | 209 ------
 .../appenders/LoggerAppenderEcho.php          | 128 ++--
 .../appenders/LoggerAppenderFile.php          | 300 ++++----
 .../appenders/LoggerAppenderMail.php          | 229 +++---
 .../appenders/LoggerAppenderMailEvent.php     | 314 ++++----
 .../appenders/LoggerAppenderNull.php          |  98 ++-
 .../appenders/LoggerAppenderPDO.php           | 296 ++++++++
 .../appenders/LoggerAppenderPhp.php           | 109 ++-
 .../appenders/LoggerAppenderRollingFile.php   | 405 ++++++-----
 .../appenders/LoggerAppenderSocket.php        | 484 ++++++-------
 .../appenders/LoggerAppenderSyslog.php        | 255 +++++--
 .../configurators/LoggerConfiguratorBasic.php |  47 ++
 .../configurators/LoggerConfiguratorIni.php   | 463 ++++++++++++
 .../configurators/LoggerConfiguratorPhp.php   | 134 ++++
 .../configurators/LoggerConfiguratorXml.php   | 441 ++++++++++++
 .../filters/LoggerFilterDenyAll.php           |  56 ++
 .../filters/LoggerFilterLevelMatch.php        | 104 +++
 .../filters/LoggerFilterLevelRange.php        | 146 ++++
 .../filters/LoggerFilterStringMatch.php       |  89 +++
 .../helpers/LoggerBasicPatternConverter.php   |  71 ++
 .../LoggerCategoryPatternConverter.php        |  44 ++
 .../LoggerClassNamePatternConverter.php       |  45 ++
 .../helpers/LoggerDatePatternConverter.php    |  53 ++
 .../helpers/LoggerFormattingInfo.php          |  66 +-
 .../helpers/LoggerLiteralPatternConverter.php |  57 ++
 .../LoggerLocationPatternConverter.php        |  63 ++
 .../helpers/LoggerMDCPatternConverter.php     |  50 ++
 .../helpers/LoggerNamedPatternConverter.php   |  77 ++
 .../helpers/LoggerOptionConverter.php         | 596 ++++++++--------
 .../helpers/LoggerPatternConverter.php        | 232 +++---
 .../helpers/LoggerPatternParser.php           | 672 ++++++++----------
 .../log4php.debug/helpers/LoggerTransform.php |  95 ---
 .../layouts/LoggerLayoutHtml.php              | 185 +++--
 ...ternLayout.php => LoggerLayoutPattern.php} | 247 +++----
 .../layouts/LoggerLayoutSimple.php            |  69 +-
 .../layouts/LoggerLayoutTTCC.php              | 157 ++--
 .../log4php.debug/layouts/LoggerLayoutXml.php | 222 ++++++
 .../log4php.debug/layouts/LoggerXmlLayout.php | 206 ------
 .../or/LoggerDefaultRenderer.php              |  58 --
 .../log4php.debug/or/LoggerObjectRenderer.php |  63 --
 .../log4php.debug/or/LoggerRendererMap.php    | 184 -----
 .../renderers/LoggerRendererDefault.php       |  51 ++
 .../renderers/LoggerRendererMap.php           | 149 ++++
 .../renderers/LoggerRendererObject.php        |  46 ++
 .../log4php.debug/spi/LoggerConfigurator.php  |  65 --
 libraries/log4php.debug/spi/LoggerFactory.php |  52 --
 libraries/log4php.debug/spi/LoggerFilter.php  | 113 ---
 .../log4php.debug/spi/LoggerLocationInfo.php  | 116 ---
 .../log4php.debug/spi/LoggerLoggingEvent.php  | 384 ----------
 .../tutorials/log4php/log4php.pkg             |  28 +
 .../varia/LoggerDenyAllFilter.php             |  57 --
 .../varia/LoggerLevelMatchFilter.php          | 119 ----
 .../varia/LoggerLevelRangeFilter.php          | 168 -----
 .../varia/LoggerStringMatchFilter.php         | 108 ---
 .../xml/LoggerDOMConfigurator.php             | 609 ----------------
 libraries/log4php.debug/xml/log4php.dtd       | 148 ++++
 libraries/nusoap/nusoap.php                   |   2 +-
 modules/Accounts/Accounts.php                 |   2 +-
 modules/Calendar/Activity.php                 |   2 +-
 modules/Campaigns/Campaigns.php               |   2 +-
 modules/Contacts/Contacts.php                 |   2 +-
 modules/CustomView/ListViewTop.php            |   2 +-
 modules/Documents/Documents.php               |   2 +-
 modules/Emails/Emails.php                     |   4 +-
 modules/Faq/Faq.php                           |   2 +-
 modules/HelpDesk/HelpDesk.php                 |   2 +-
 modules/Invoice/Invoice.php                   |   2 +-
 modules/Leads/Leads.php                       |   2 +-
 modules/Potentials/Potentials.php             |   2 +-
 modules/PriceBooks/PriceBooks.php             |   2 +-
 modules/Products/Products.php                 |   2 +-
 modules/PurchaseOrder/PurchaseOrder.php       |   2 +-
 modules/Quotes/Quotes.php                     |   2 +-
 modules/Reports/ReportSharing.php             |   2 +-
 modules/Reports/ReportType.php                |   2 +-
 modules/SalesOrder/SalesOrder.php             |   2 +-
 modules/Users/DefaultDataPopulator.php        |   2 +-
 modules/Users/Users.php                       |   2 +-
 modules/Vendors/Vendors.php                   |   2 +-
 modules/Vtiger/layout_utils.php               |   2 +-
 webservice.php                                |   4 +-
 113 files changed, 8142 insertions(+), 8475 deletions(-)
 create mode 100644 libraries/log4php.debug/LoggerAppenderPool.php
 delete mode 100644 libraries/log4php.debug/LoggerAppenderSkeleton.php
 delete mode 100644 libraries/log4php.debug/LoggerBasicConfigurator.php
 delete mode 100644 libraries/log4php.debug/LoggerCategory.php
 create mode 100644 libraries/log4php.debug/LoggerConfigurator.php
 delete mode 100644 libraries/log4php.debug/LoggerDefaultCategoryFactory.php
 create mode 100644 libraries/log4php.debug/LoggerException.php
 create mode 100644 libraries/log4php.debug/LoggerFilter.php
 create mode 100644 libraries/log4php.debug/LoggerLocationInfo.php
 delete mode 100644 libraries/log4php.debug/LoggerLog.php
 create mode 100644 libraries/log4php.debug/LoggerLoggingEvent.php
 delete mode 100644 libraries/log4php.debug/LoggerManager.php
 delete mode 100644 libraries/log4php.debug/LoggerPropertyConfigurator.php
 create mode 100644 libraries/log4php.debug/LoggerReflectionUtils.php
 create mode 100644 libraries/log4php.debug/appenders/LoggerAppenderAdodb.php
 delete mode 100644 libraries/log4php.debug/appenders/LoggerAppenderDb.php
 create mode 100644 libraries/log4php.debug/appenders/LoggerAppenderPDO.php
 create mode 100644 libraries/log4php.debug/configurators/LoggerConfiguratorBasic.php
 create mode 100644 libraries/log4php.debug/configurators/LoggerConfiguratorIni.php
 create mode 100644 libraries/log4php.debug/configurators/LoggerConfiguratorPhp.php
 create mode 100644 libraries/log4php.debug/configurators/LoggerConfiguratorXml.php
 create mode 100644 libraries/log4php.debug/filters/LoggerFilterDenyAll.php
 create mode 100644 libraries/log4php.debug/filters/LoggerFilterLevelMatch.php
 create mode 100644 libraries/log4php.debug/filters/LoggerFilterLevelRange.php
 create mode 100644 libraries/log4php.debug/filters/LoggerFilterStringMatch.php
 create mode 100644 libraries/log4php.debug/helpers/LoggerBasicPatternConverter.php
 create mode 100644 libraries/log4php.debug/helpers/LoggerCategoryPatternConverter.php
 create mode 100644 libraries/log4php.debug/helpers/LoggerClassNamePatternConverter.php
 create mode 100644 libraries/log4php.debug/helpers/LoggerDatePatternConverter.php
 create mode 100644 libraries/log4php.debug/helpers/LoggerLiteralPatternConverter.php
 create mode 100644 libraries/log4php.debug/helpers/LoggerLocationPatternConverter.php
 create mode 100644 libraries/log4php.debug/helpers/LoggerMDCPatternConverter.php
 create mode 100644 libraries/log4php.debug/helpers/LoggerNamedPatternConverter.php
 delete mode 100644 libraries/log4php.debug/helpers/LoggerTransform.php
 rename libraries/log4php.debug/layouts/{LoggerPatternLayout.php => LoggerLayoutPattern.php} (64%)
 create mode 100644 libraries/log4php.debug/layouts/LoggerLayoutXml.php
 delete mode 100644 libraries/log4php.debug/layouts/LoggerXmlLayout.php
 delete mode 100644 libraries/log4php.debug/or/LoggerDefaultRenderer.php
 delete mode 100644 libraries/log4php.debug/or/LoggerObjectRenderer.php
 delete mode 100644 libraries/log4php.debug/or/LoggerRendererMap.php
 create mode 100644 libraries/log4php.debug/renderers/LoggerRendererDefault.php
 create mode 100644 libraries/log4php.debug/renderers/LoggerRendererMap.php
 create mode 100644 libraries/log4php.debug/renderers/LoggerRendererObject.php
 delete mode 100644 libraries/log4php.debug/spi/LoggerConfigurator.php
 delete mode 100644 libraries/log4php.debug/spi/LoggerFactory.php
 delete mode 100644 libraries/log4php.debug/spi/LoggerFilter.php
 delete mode 100644 libraries/log4php.debug/spi/LoggerLocationInfo.php
 delete mode 100644 libraries/log4php.debug/spi/LoggerLoggingEvent.php
 create mode 100644 libraries/log4php.debug/tutorials/log4php/log4php.pkg
 delete mode 100644 libraries/log4php.debug/varia/LoggerDenyAllFilter.php
 delete mode 100644 libraries/log4php.debug/varia/LoggerLevelMatchFilter.php
 delete mode 100644 libraries/log4php.debug/varia/LoggerLevelRangeFilter.php
 delete mode 100644 libraries/log4php.debug/varia/LoggerStringMatchFilter.php
 delete mode 100644 libraries/log4php.debug/xml/LoggerDOMConfigurator.php
 create mode 100644 libraries/log4php.debug/xml/log4php.dtd

diff --git a/SendSupportNotification.php b/SendSupportNotification.php
index 70dd06371..17c81cd4b 100755
--- a/SendSupportNotification.php
+++ b/SendSupportNotification.php
@@ -28,7 +28,7 @@ require("config.php");
 global $adb;
 global $log;
 global $HELPDESK_SUPPORT_EMAIL_ID,$HELPDESK_SUPPORT_NAME;
-$log =& LoggerManager::getLogger('SendSupportNotification');
+$log = Logger::getLogger('SendSupportNotification');
 $log->debug(" invoked SendSupportNotification ");
 
 // retrieve the translated strings.
diff --git a/cron/SendReminder.service b/cron/SendReminder.service
index 0fc36d3a9..3f1c2d64d 100644
--- a/cron/SendReminder.service
+++ b/cron/SendReminder.service
@@ -42,7 +42,7 @@ if(empty($from)) {
 global $adb;
 global $log;
 global $site_URL;
-$log =& LoggerManager::getLogger('SendReminder');
+$log =Logger::getLogger('SendReminder');
 $log->debug(" invoked SendReminder ");
 
 // retrieve the translated strings.
diff --git a/cron/modules/SalesOrder/RecurringInvoice.service b/cron/modules/SalesOrder/RecurringInvoice.service
index 3028fb802..c36a70574 100644
--- a/cron/modules/SalesOrder/RecurringInvoice.service
+++ b/cron/modules/SalesOrder/RecurringInvoice.service
@@ -12,7 +12,7 @@ require_once('include/utils/utils.php');
 require_once('include/logging.php');
 
 global $adb, $log;
-$log =& LoggerManager::getLogger('RecurringInvoice');
+$log = Logger::getLogger('RecurringInvoice');
 $log->debug("invoked RecurringInvoice");
 
 $currentDate = date('Y-m-d');
diff --git a/data/Tracker.php b/data/Tracker.php
index 706dbc300..25b563a06 100755
--- a/data/Tracker.php
+++ b/data/Tracker.php
@@ -46,7 +46,7 @@ class Tracker {
     );
 	function __construct()
     {
-        $this->log = LoggerManager::getLogger('Tracker');
+        $this->log = Logger::getLogger('Tracker');
 		// $this->db = PearDatabase::getInstance();
 		global $adb;
         $this->db = $adb;
diff --git a/include/database/PearDatabase.php b/include/database/PearDatabase.php
index fa41139be..ee026a4ee 100644
--- a/include/database/PearDatabase.php
+++ b/include/database/PearDatabase.php
@@ -17,8 +17,8 @@ require_once 'include/logging.php';
 include_once 'libraries/adodb/adodb.inc.php';
 require_once 'libraries/adodb/adodb-xmlschema.inc.php';
 
-$log = LoggerManager::getLogger('VT');
-$logsqltm = LoggerManager::getLogger('SQLTIME');
+$log = Logger::getLogger('VT');
+$logsqltm = Logger::getLogger('SQLTIME');
 
 // Callback class useful to convert PreparedStatement Question Marks to SQL value
 // See function convertPS2Sql in PearDatabase below
@@ -115,7 +115,7 @@ class PearDatabase{
     function println($msg)
     {
 		require_once('include/logging.php');
-		$log1 = LoggerManager::getLogger('VT');
+		$log1 = Logger::getLogger('VT');
 		if(is_array($msg)) {
 		    $log1->info("PearDatabse ->".print_r($msg,true));
 		} else {
@@ -840,7 +840,7 @@ class PearDatabase{
 	 */
     function __construct($dbtype='',$host='',$dbname='',$username='',$passwd='') {
 		global $currentModule;
-		$this->log = LoggerManager::getLogger('PearDatabase_'. $currentModule);
+		$this->log = Logger::getLogger('PearDatabase_'. $currentModule);
 		$this->resetSettings($dbtype,$host,$dbname,$username,$passwd);
 
 		// Initialize performance parameters
diff --git a/include/logging.php b/include/logging.php
index df011c77e..af6ca6578 100644
--- a/include/logging.php
+++ b/include/logging.php
@@ -30,10 +30,12 @@ if(isset($PERFORMANCE_CONFIG) && isset($PERFORMANCE_CONFIG['LOG4PHP_DEBUG']) &&
 // END
 define('LOG4PHP_DEFAULT_INIT_OVERRIDE', true);
 
-require_once(LOG4PHP_DIR.'/LoggerManager.php');
-require_once(LOG4PHP_DIR.'/LoggerPropertyConfigurator.php');
+require_once(LOG4PHP_DIR.'/Logger.php');
+//require_once(LOG4PHP_DIR.'/LoggerPropertyConfigurator.php');
+//
+//$config = new LoggerPropertyConfigurator();
+//$config->configure('log4php.properties');
+Logger::configure('log4php.properties');
 
-$config = new LoggerPropertyConfigurator();
-$config->configure('log4php.properties');
 
 ?>
\ No newline at end of file
diff --git a/include/utils/export.php b/include/utils/export.php
index 0fb897570..44c2cedf8 100755
--- a/include/utils/export.php
+++ b/include/utils/export.php
@@ -107,7 +107,7 @@ function export($type){
 		// Refer to the logic in setting $currentModule in index.php
 		$focus = CRMEntity::getInstance($type);
     }
-    $log = LoggerManager::getLogger('export_'.$type);
+    $log = Logger::getLogger('export_'.$type);
     $db = PearDatabase::getInstance();
 
 	$oCustomView = new CustomView("$type");
diff --git a/libraries/log4php.debug/Logger.php b/libraries/log4php.debug/Logger.php
index e50215ca6..ac191721e 100644
--- a/libraries/log4php.debug/Logger.php
+++ b/libraries/log4php.debug/Logger.php
@@ -1,67 +1,627 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
+ * 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
  * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
+ *		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
  */
 
 /**
- * @ignore 
+ * LOG4PHP_DIR points to the log4php root directory.
+ *
+ * If not defined it will be set automatically when the first package classfile 
+ * is included
+ * 
+ * @var string 
  */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
- 
-require_once(LOG4PHP_DIR . '/LoggerCategory.php');
-require_once(LOG4PHP_DIR . '/LoggerManager.php');
+
+spl_autoload_register(array('Logger', 'autoload'));
 
 /**
- * Main class for logging operations  
+ * This is the central class in the log4j package. Most logging operations, 
+ * except configuration, are done through this class. 
+ *
+ * In log4j this class replaces the Category class. There is no need to 
+ * port deprecated classes; log4php Logger class doesn't extend Category.
  *
- * @author       VxR <vxr@vxr.it>
- * @version      $Revision: 1.9 $
+ * @category   log4php
  * @package log4php
+ * @license	   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version	   SVN: $Id: Logger.php 824193 2009-10-11 22:51:24Z chammers $
+ * @link	   http://logging.apache.org/log4php
  */
-class Logger extends LoggerCategory {
-
-    /**
-     * Constructor
-     * @param string $name logger name 
-     */    
-    function Logger($name)
-    {
-        $this->LoggerCategory($name);
-    }
-    
-    /**
-     * Get a Logger by name (Delegate to {@link LoggerManager})
-     * @param string $name logger name
-     * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
-     * @return Logger
-     * @static 
-     */    
-    function &getLogger($name, $factory = null)
-    {
-        return LoggerManager::getLogger($name, $factory);
-    }
-    
-    /**
-     * get the Root Logger (Delegate to {@link LoggerManager})
-     * @return LoggerRoot
-     * @static 
-     */    
-    function &getRootLogger()
-    {
-        return LoggerManager::getRootLogger();    
-    }
+ /*
+  * TODO:
+  * Localization: setResourceBundle($bundle) : not supported
+  * Localization: getResourceBundle: not supported
+  * Localization: getResourceBundleString($key): not supported
+  * Localization: l7dlog($priority, $key, $params, $t) : not supported
+  */
+class Logger {
+	private static $_classes = array(
+		'LoggerException' => '/LoggerException.php',
+		'LoggerHierarchy' => '/LoggerHierarchy.php',
+		'LoggerLayout' => '/LoggerLayout.php',
+		'LoggerLevel' => '/LoggerLevel.php',
+		'LoggerMDC' => '/LoggerMDC.php',
+		'LoggerNDC' => '/LoggerNDC.php',
+		'LoggerReflectionUtils' => '/LoggerReflectionUtils.php',
+		'LoggerConfigurator' => '/LoggerConfigurator.php',
+		'LoggerConfiguratorBasic' => '/configurators/LoggerConfiguratorBasic.php',
+		'LoggerConfiguratorIni' => '/configurators/LoggerConfiguratorIni.php',
+		'LoggerConfiguratorPhp' => '/configurators/LoggerConfiguratorPhp.php',
+		'LoggerConfiguratorXml' => '/configurators/LoggerConfiguratorXml.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',
+		'LoggerAppenderEcho' => '/appenders/LoggerAppenderEcho.php',
+		'LoggerAppenderFile' => '/appenders/LoggerAppenderFile.php',
+		'LoggerAppenderMail' => '/appenders/LoggerAppenderMail.php',
+		'LoggerAppenderMailEvent' => '/appenders/LoggerAppenderMailEvent.php',
+		'LoggerAppenderNull' => '/appenders/LoggerAppenderNull.php',
+		'LoggerAppenderPhp' => '/appenders/LoggerAppenderPhp.php',
+		'LoggerAppenderRollingFile' => '/appenders/LoggerAppenderRollingFile.php',
+		'LoggerAppenderSocket' => '/appenders/LoggerAppenderSocket.php',
+		'LoggerAppenderSyslog' => '/appenders/LoggerAppenderSyslog.php',
+		'LoggerFormattingInfo' => '/helpers/LoggerFormattingInfo.php',
+		'LoggerOptionConverter' => '/helpers/LoggerOptionConverter.php',
+		'LoggerPatternConverter' => '/helpers/LoggerPatternConverter.php',
+		'LoggerBasicPatternConverter' => '/helpers/LoggerBasicPatternConverter.php',
+		'LoggerCategoryPatternConverter' => '/helpers/LoggerCategoryPatternConverter.php',
+		'LoggerClassNamePatternConverter' => '/helpers/LoggerClassNamePatternConverter.php',
+		'LoggerDatePatternConverter' => '/helpers/LoggerDatePatternConverter.php',
+		'LoggerLiteralPatternConverter' => '/helpers/LoggerLiteralPatternConverter.php',
+		'LoggerLocationPatternConverter' => '/helpers/LoggerLocationPatternConverter.php',
+		'LoggerMDCPatternConverter' => '/helpers/LoggerMDCPatternConverter.php',
+		'LoggerNamedPatternConverter' => '/helpers/LoggerNamedPatternConverter.php',
+		'LoggerBasicPatternConverter' => '/helpers/LoggerBasicPatternConverter.php',
+		'LoggerLiteralPatternConverter' => '/helpers/LoggerLiteralPatternConverter.php',
+		'LoggerDatePatternConverter' => '/helpers/LoggerDatePatternConverter.php',
+		'LoggerMDCPatternConverter' => '/helpers/LoggerMDCPatternConverter.php',
+		'LoggerLocationPatternConverter' => '/helpers/LoggerLocationPatternConverter.php',
+		'LoggerNamedPatternConverter' => '/helpers/LoggerNamedPatternConverter.php',
+		'LoggerClassNamePatternConverter' => '/helpers/LoggerClassNamePatternConverter.php',
+		'LoggerCategoryPatternConverter' => '/helpers/LoggerCategoryPatternConverter.php',
+		'LoggerPatternParser' => '/helpers/LoggerPatternParser.php',
+		'LoggerLayoutHtml' => '/layouts/LoggerLayoutHtml.php',
+		'LoggerLayoutSimple' => '/layouts/LoggerLayoutSimple.php',
+		'LoggerLayoutTTCC' => '/layouts/LoggerLayoutTTCC.php',
+		'LoggerLayoutPattern' => '/layouts/LoggerLayoutPattern.php',
+		'LoggerLayoutXml' => '/layouts/LoggerLayoutXml.php',
+		'LoggerRendererDefault' => '/renderers/LoggerRendererDefault.php',
+		'LoggerRendererObject' => '/renderers/LoggerRendererObject.php',
+		'LoggerRendererMap' => '/renderers/LoggerRendererMap.php',
+		'LoggerLocationInfo' => '/LoggerLocationInfo.php',
+		'LoggerLoggingEvent' => '/LoggerLoggingEvent.php',
+		'LoggerFilter' => '/LoggerFilter.php',
+		'LoggerFilterDenyAll' => '/filters/LoggerFilterDenyAll.php',
+		'LoggerFilterLevelMatch' => '/filters/LoggerFilterLevelMatch.php',
+		'LoggerFilterLevelRange' => '/filters/LoggerFilterLevelRange.php',
+		'LoggerFilterStringMatch' => '/filters/LoggerFilterStringMatch.php',
+	);
+
+	/**
+	 * Class autoloader
+	 * This method is provided to be invoked within an __autoload() magic method.
+	 * @param string class name
+	 */
+	public static function autoload($className) {
+		if(isset(self::$_classes[$className])) {
+			include LOG4PHP_DIR.self::$_classes[$className];
+		}
+	}
+
+	/**
+	 * Additivity is set to true by default, that is children inherit the 
+	 * appenders of their ancestors by default.
+	 * @var boolean
+	 */
+	private $additive = true;
+	
+	/** @var string fully qualified class name */
+	private $fqcn = 'Logger';
+
+	/** @var LoggerLevel The assigned level of this category. */
+	private $level = null;
+	
+	/** @var string name of this category. */
+	private $name = '';
+	
+	/** @var Logger The parent of this category. Null if this is the root logger*/
+	private $parent = null;
+	
+	/**
+	 * @var array collection of appenders
+	 * @see LoggerAppender
+	 */
+	private $aai = array();
+
+	/** the hierarchy used by log4php */
+	private static $hierarchy;
+	
+	/** the configurator class name */
+	private static $configurationClass = 'LoggerConfiguratorBasic';
+	
+	/** the path to the configuration file */
+	private static $configurationFile = null;
+	
+	/** inidicates if log4php has already been initialized */
+	private static $initialized = false;
+	
+	/**
+	 * Constructor.
+	 * @param  string  $name  Category name	  
+	 */
+	public function __construct($name) {
+		$this->name = $name;
+	}
+	
+	/**
+	 * Return the category name.
+	 * @return string
+	 */
+	public function getName() {
+		return $this->name;
+	} 
+
+	/**
+	 * Returns the parent of this category.
+	 * @return Logger
+	 */
+	public function getParent() {
+		return $this->parent;
+	}	  
+	
+	/**
+	 * Returns the hierarchy used by this Logger.
+	 * Caution: do not use this hierarchy unless you have called initialize().
+	 * To get Loggers, use the Logger::getLogger and Logger::getRootLogger methods
+	 * instead of operating on on the hierarchy directly.
+	 * 
+	 * @deprecated - will be moved to private
+	 * @return LoggerHierarchy
+	 */
+	public static function getHierarchy() {
+		if(!isset(self::$hierarchy)) {
+			self::$hierarchy = new LoggerHierarchy(new LoggerRoot());
+		}
+		return self::$hierarchy;
+	}
+	
+	/* Logging methods */
+	/**
+	 * Log a message object with the DEBUG level including the caller.
+	 *
+	 * @param mixed $message message
+	 * @param mixed $caller caller object or caller string id
+	 */
+	public function debug($message, $caller = null) {
+		$this->logLevel($message, LoggerLevel::getLevelDebug(), $caller);
+	} 
+
+
+	/**
+	 * Log a message object with the INFO Level.
+	 *
+	 * @param mixed $message message
+	 * @param mixed $caller caller object or caller string id
+	 */
+	public function info($message, $caller = null) {
+		$this->logLevel($message, LoggerLevel::getLevelInfo(), $caller);
+	}
+
+	/**
+	 * Log a message with the WARN level.
+	 *
+	 * @param mixed $message message
+	 * @param mixed $caller caller object or caller string id
+	 */
+	public function warn($message, $caller = null) {
+		$this->logLevel($message, LoggerLevel::getLevelWarn(), $caller);
+	}
+	
+	/**
+	 * Log a message object with the ERROR level including the caller.
+	 *
+	 * @param mixed $message message
+	 * @param mixed $caller caller object or caller string id
+	 */
+	public function error($message, $caller = null) {
+		$this->logLevel($message, LoggerLevel::getLevelError(), $caller);
+	}
+	
+	/**
+	 * Log a message object with the FATAL level including the caller.
+	 *
+	 * @param mixed $message message
+	 * @param mixed $caller caller object or caller string id
+	 */
+	public function fatal($message, $caller = null) {
+		$this->logLevel($message, LoggerLevel::getLevelFatal(), $caller);
+	}
+	
+	/**
+	 * This method creates a new logging event and logs the event without further checks.
+	 *
+	 * It should not be called directly. Use {@link info()}, {@link debug()}, {@link warn()},
+	 * {@link error()} and {@link fatal()} wrappers.
+	 *
+	 * @param string $fqcn Fully Qualified Class Name of the Logger
+	 * @param mixed $caller caller object or caller string id
+	 * @param LoggerLevel $level log level	   
+	 * @param mixed $message message
+	 * @see LoggerLoggingEvent			
+	 */
+	public function forcedLog($fqcn, $caller, $level, $message) {
+		$this->callAppenders(new LoggerLoggingEvent($fqcn, $this, $level, $message));
+	} 
+	
+	
+		/**
+	 * Check whether this category is enabled for the DEBUG Level.
+	 * @return boolean
+	 */
+	public function isDebugEnabled() {
+		return $this->isEnabledFor(LoggerLevel::getLevelDebug());
+	}		
+
+	/**
+	 * Check whether this category is enabled for a given Level passed as parameter.
+	 *
+	 * @param LoggerLevel level
+	 * @return boolean
+	 */
+	public function isEnabledFor($level) {
+		return (bool)($level->isGreaterOrEqual($this->getEffectiveLevel()));
+	} 
+
+	/**
+	 * Check whether this category is enabled for the info Level.
+	 * @return boolean
+	 * @see LoggerLevel
+	 */
+	public function isInfoEnabled() {
+		return $this->isEnabledFor(LoggerLevel::getLevelInfo());
+	} 
+
+	/**
+	 * This generic form is intended to be used by wrappers.
+	 *
+	 * @param LoggerLevel $priority a valid level
+	 * @param mixed $message message
+	 * @param mixed $caller caller object or caller string id
+	 */
+	public function log($priority, $message, $caller = null) {
+		if($this->isEnabledFor($priority)) {
+			$this->forcedLog($this->fqcn, $caller, $priority, $message);
+		}
+	}
+	
+	/**
+	 * If assertion parameter is false, then logs msg as an error statement.
+	 *
+	 * @param bool $assertion
+	 * @param string $msg message to log
+	 */
+	public function assertLog($assertion = true, $msg = '') {
+		if($assertion == false) {
+			$this->error($msg);
+		}
+	}
+	 
+	private function logLevel($message, $level, $caller = null) {
+		if($level->isGreaterOrEqual($this->getEffectiveLevel())) {
+			$this->forcedLog($this->fqcn, $caller, $level, $message);
+		}
+	} 
+	
+	/* Factory methods */ 
+	
+	/**
+	 * Get a Logger by name (Delegate to {@link Logger})
+	 * 
+	 * @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();
+		}
+		return self::getHierarchy()->getLogger($name);
+	}
+	
+	/**
+	 * get the Root Logger (Delegate to {@link Logger})
+	 * @return LoggerRoot
+	 * @static 
+	 */	   
+	public static function getRootLogger() {
+		if(!self::isInitialized()) {
+			self::initialize();
+		}
+		return self::getHierarchy()->getRootLogger();	  
+	}
+	
+	/* Configuration methods */
+	
+	/**
+	 * Add a new Appender to the list of appenders of this Category instance.
+	 *
+	 * @param LoggerAppender $newAppender
+	 */
+	public function addAppender($newAppender) {
+		$appenderName = $newAppender->getName();
+		$this->aai[$appenderName] = $newAppender;
+	}
+	
+	/**
+	 * Remove all previously added appenders from this Category instance.
+	 */
+	public function removeAllAppenders() {
+		$appenderNames = array_keys($this->aai);
+		$enumAppenders = count($appenderNames);
+		for($i = 0; $i < $enumAppenders; $i++) {
+			$this->removeAppender($appenderNames[$i]); 
+		}
+	} 
+			
+	/**
+	 * Remove the appender passed as parameter form the list of appenders.
+	 *
+	 * @param mixed $appender can be an appender name or a {@link LoggerAppender} object
+	 */
+	public function removeAppender($appender) {
+		if($appender instanceof LoggerAppender) {
+			$appender->close();
+			unset($this->aai[$appender->getName()]);
+		} else if (is_string($appender) and isset($this->aai[$appender])) {
+			$this->aai[$appender]->close();
+			unset($this->aai[$appender]);
+		}
+	} 
+			
+	/**
+	 * Call the appenders in the hierarchy starting at this.
+	 *
+	 * @param LoggerLoggingEvent $event 
+	 */
+	public function callAppenders($event) {
+		if(count($this->aai) > 0) {
+			foreach(array_keys($this->aai) as $appenderName) {
+				$this->aai[$appenderName]->doAppend($event);
+			}
+		}
+		if($this->parent != null and $this->getAdditivity()) {
+			$this->parent->callAppenders($event);
+		}
+	}
+	
+	/**
+	 * Get the appenders contained in this category as an array.
+	 * @return array collection of appenders
+	 */
+	public function getAllAppenders() {
+		return array_values($this->aai);
+	}
+	
+	/**
+	 * Look for the appender named as name.
+	 * @return LoggerAppender
+	 */
+	public function getAppender($name) {
+		return $this->aai[$name];
+	}
+	
+	/**
+	 * Get the additivity flag for this Category instance.
+	 * @return boolean
+	 */
+	public function getAdditivity() {
+		return $this->additive;
+	}
+ 
+	/**
+	 * Starting from this category, search the category hierarchy for a non-null level and return it.
+	 * @see LoggerLevel
+	 * @return LoggerLevel or null
+	 */
+	public function getEffectiveLevel() {
+		for($c = $this; $c != null; $c = $c->parent) {
+			if($c->getLevel() !== null) {
+				return $c->getLevel();
+			}
+		}
+		return null;
+	}
+  
+	/**
+	 * Returns the assigned Level, if any, for this Category.
+	 * @return LoggerLevel or null 
+	 */
+	public function getLevel() {
+		return $this->level;
+	}
+	
+	/**
+	 * Set the level of this Category.
+	 *
+	 * @param LoggerLevel $level a level string or a level constant 
+	 */
+	public function setLevel($level) {
+		$this->level = $level;
+	}
+	
+	/**
+	 * Clears all logger definitions
+	 * 
+	 * @static
+	 * @return boolean 
+	 */
+	public static function clear() {
+		return self::getHierarchy()->clear();	 
+	}
+	
+	/**
+	 * Destroy configurations for logger definitions
+	 * 
+	 * @static
+	 * @return boolean 
+	 */
+	public static function resetConfiguration() {
+		$result = self::getHierarchy()->resetConfiguration();
+		self::$initialized = false;
+		self::$configurationClass = 'LoggerConfiguratorBasic';
+		self::$configurationFile = null;
+		return $result;	 
+	}
+
+	/**
+	 * Safely close all appenders.
+	 * This is not longer necessary due the appenders shutdown via
+	 * destructors. 
+	 * @deprecated
+	 * @static
+	 */
+	public static function shutdown() {
+		return self::getHierarchy()->shutdown();	   
+	}
+	
+	/**
+	 * check if a given logger exists.
+	 * 
+	 * @param string $name logger name 
+	 * @static
+	 * @return boolean
+	 */
+	public static function exists($name) {
+		return self::getHierarchy()->exists($name);
+	}
+	
+	/**
+	 * Returns an array this whole Logger instances.
+	 * 
+	 * @static
+	 * @see Logger
+	 * @return array
+	 */
+	public static function getCurrentLoggers() {
+		return self::getHierarchy()->getCurrentLoggers();
+	}
+	
+	/**
+	 * Is the appender passed as parameter attached to this category?
+	 *
+	 * @param LoggerAppender $appender
+	 */
+	public function isAttached($appender) {
+		return isset($this->aai[$appender->getName()]);
+	} 
+		   
+	/**
+	 * Set the additivity flag for this Category instance.
+	 *
+	 * @param boolean $additive
+	 */
+	public function setAdditivity($additive) {
+		$this->additive = (bool)$additive;
+	}
+
+	/**
+	 * Sets the parent logger of this logger
+	 */
+	public function setParent(Logger $logger) {
+		$this->parent = $logger;
+	} 
+	
+	/**
+	 * Configures Log4PHP.
+	 * This method needs to be called before the first logging event
+	 * has occured. If this methode is never called, the standard configuration
+	 * takes place (@see LoggerConfiguratorBasic).
+	 * If only the configuration file is given, the configurator class will
+	 * be the XML Configurator or the INI Configurator, if no .xml ending
+	 * could be determined.
+	 * 
+	 * If a custom configurator should be used, the configuration file
+	 * is either null or the path to file the custom configurator uses.
+	 * Make sure the configurator is already or can be loaded by PHP when necessary.
+	 * 
+	 * @param String $configurationFile the configuration file
+	 * @param String $configurationClass the configurator class
+	 */
+	public static function configure($configurationFile = null, 
+									 $configurationClass = null ) {
+		if($configurationClass === null && $configurationFile === null) {
+			self::$configurationClass = 'LoggerConfiguratorBasic';
+			return;
+		}
+									 	
+		if($configurationClass !== null) {
+			self::$configurationFile = $configurationFile;
+			self::$configurationClass = $configurationClass;
+			return;
+		}
+		
+		if (strtolower(substr( $configurationFile, -4 )) == '.xml') {
+			self::$configurationFile = $configurationFile;
+			self::$configurationClass = 'LoggerConfiguratorXml';
+		} else {
+			self::$configurationFile = $configurationFile;
+			self::$configurationClass = 'LoggerConfiguratorIni';
+		}
+	}
+	
+	/**
+	 * Returns the current configurator
+	 * @return the configurator
+	 */
+	public static function getConfigurationClass() {
+		return self::$configurationClass;
+	}
+	
+	/**
+	 * Returns the current configuration file
+	 * @return the configuration file
+	 */
+	public static function getConfigurationFile() {
+		return self::$configurationFile;
+	}
+	
+	/**
+	 * Returns, true, if the log4php framework is already initialized
+	 */
+	private static function isInitialized() {
+		return self::$initialized;
+	}
+	
+	/**
+	 * Initializes the log4php framework.
+	 * @return boolean
+	 */
+	public static function initialize() {
+		self::$initialized = true;
+		$instance = LoggerReflectionUtils::createObject(self::$configurationClass);
+		$result = $instance->configure(self::getHierarchy(), self::$configurationFile);
+		return $result;
+	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/LoggerAppender.php b/libraries/log4php.debug/LoggerAppender.php
index c952da9fd..105956dee 100644
--- a/libraries/log4php.debug/LoggerAppender.php
+++ b/libraries/log4php.debug/LoggerAppender.php
@@ -1,18 +1,20 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
  */
 
@@ -24,195 +26,242 @@ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
 /**
  * Abstract class that defines output logs strategies.
  *
- * @author  VxR <vxr@vxr.it>
- * @version $Revision: 1.14 $
+ * @version $Revision: 822392 $
  * @package log4php
- * @abstract
  */
-class LoggerAppender {
-
-    /**
-     * Factory
-     *
-     * @param string $name appender name
-     * @param string $class create an instance of this appender class
-     * @return LoggerAppender
-     */
-    function factory($name, $class)
-    {
-        $class = basename($class);
-        if (!empty($class)) {
-            if (!class_exists($class)) 
-                @include_once(LOG4PHP_DIR . "/appenders/{$class}.php");
-            if (class_exists($class))
-                return new $class($name);
-        }
-        return null;
-    }
-    
-    /**
-     * Singleton
-     *
-     * @param string $name appender name
-     * @param string $class create or get a reference instance of this class
-     * @return LoggerAppender 
-     */
-    function &singleton($name, $class = '')
-    {
-        static $instances;
-        
-        if (!empty($name)) {
-            if (!isset($instances[$name])) {
-                if (!empty($class)) {
-                    $appender = LoggerAppender::factory($name, $class);
-                    if ($appender !== null) { 
-                        $instances[$name] = $appender;
-                        return $instances[$name];
-                    }
-                }
-                return null;
-            }
-            return $instances[$name];                
-        }        
-        return null;        
-    }
-    
-    /* --------------------------------------------------------------------------*/
-    /* --------------------------------------------------------------------------*/
-    /* --------------------------------------------------------------------------*/
-    
-    /**
-     * Add a filter to the end of the filter list.
-     *
-     * @param LoggerFilter $newFilter add a new LoggerFilter
-     * @abstract
-     */
-    function addFilter($newFilter)
-    {
-        // override 
-    }
-    
-    /**
-     * Clear the list of filters by removing all the filters in it.
-     * @abstract
-     */
-    function clearFilters()
-    {
-        // override    
-    }
-
-    /**
-     * Return the first filter in the filter chain for this Appender. 
-     * The return value may be <i>null</i> if no is filter is set.
-     * @return Filter
-     */
-    function &getFilter()
-    {
-        // override    
-    } 
-    
-    /**
-     * Release any resources allocated.
-     * Subclasses of {@link LoggerAppender} should implement 
-     * this method to perform proper closing procedures.
-     * @abstract
-     */
-    function close()
-    {
-        //override me
-    }
+abstract class LoggerAppender {
+	
+	/**
+	 * @var boolean closed appender flag
+	 */
+	protected $closed = false;
+	
+	/**
+	 * The first filter in the filter chain
+	 * @var LoggerFilter
+	 */
+	protected $filter = null;
+			
+	/**
+	 * LoggerLayout for this appender. It can be null if appender has its own layout
+	 * @var LoggerLayout
+	 */
+	protected $layout = null; 
+		   
+	/**
+	 * @var string Appender name
+	 */
+	protected $name;
+		   
+	/**
+	 * @var LoggerLevel There is no level threshold filtering by default.
+	 */
+	protected $threshold = null;
+	
+	/**
+	 * @var boolean needs a layout formatting ?
+	 */
+	protected $requiresLayout = false;
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $name appender name
+	 */
+	public function __construct($name = '') {
+		$this->name = $name;
+	}
 
-    /**
-     * This method performs threshold checks and invokes filters before
-     * delegating actual logging to the subclasses specific <i>append()</i> method.
-     * @param LoggerLoggingEvent $event
-     * @abstract
-     */
-    function doAppend($event)
-    {
-        //override me    
-    }
+	/**
+	 * Add a filter to the end of the filter list.
+	 *
+	 * @param LoggerFilter $newFilter add a new LoggerFilter
+	 */
+	public function addFilter($newFilter) {
+		if($this->filter === null) {
+			$this->filter = $newFilter;
+		} else {
+			$this->filter->addNext($newFilter);
+		}
+	}
+	
+	/**
+	 * Clear the list of filters by removing all the filters in it.
+	 * @abstract
+	 */
+	public function clearFilters() {
+		unset($this->filter);
+		$this->filter = null;
+	}
 
-    /**
-     * Get the name of this appender.
-     * @return string
-     */
-    function getName()
-    {
-        //override me    
-    }
+	/**
+	 * Return the first filter in the filter chain for this Appender. 
+	 * The return value may be <i>null</i> if no is filter is set.
+	 * @return LoggerFilter
+	 */
+	public function getFilter() {
+		return $this->filter;
+	} 
+	
+	/** 
+	 * Return the first filter in the filter chain for this Appender. 
+	 * The return value may be <i>null</i> if no is filter is set.
+	 * @return LoggerFilter
+	 */
+	public function getFirstFilter() {
+		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()
+	 * @param LoggerLoggingEvent $event
+	 */
+	public function doAppend(LoggerLoggingEvent $event) {
+		if($this->closed) {
+			return;
+		}
+		
+		if(!$this->isAsSevereAsThreshold($event->getLevel())) {
+			return;
+		}
 
-    /**
-     * Do not use this method.
-     *
-     * @param object $errorHandler
-     */
-    function setErrorHandler($errorHandler)
-    {
-        // override me
-    }
-    
-    /**
-     * Do not use this method.
-     * @return object Returns the ErrorHandler for this appender.
-     */
-    function &getErrorHandler()
-    {
-        return $this->errorHandler;
-    } 
+		$f = $this->getFirstFilter();
+		while($f !== null) {
+			switch ($f->decide($event)) {
+				case LoggerFilter::DENY: return;
+				case LoggerFilter::ACCEPT: return $this->append($event);
+				case LoggerFilter::NEUTRAL: $f = $f->getNext();
+			}
+		}
+		$this->append($event);	  
+	}	 
 
-    /**
-     * Set the Layout for this appender.
-     *
-     * @param LoggerLayout $layout
-     */
-    function setLayout($layout)
-    {
-        // override me
-    }
-    
-    /**
-     * Returns this appender layout.
-     * @return LoggerLayout
-     */
-    function &getLayout()
-    {
-        // override me
-    }
-
-    /**
-     * Set the name of this appender.
-     *
-     * The name is used by other components to identify this appender.
-     *
-     * @param string $name
-     */
-    function setName($name) 
-    {
-        // override me    
-    }
+	/**
+	 * Set the Layout for this appender.
+	 * @see LoggerAppender::setLayout()
+	 * @param LoggerLayout $layout
+	 */
+	public function setLayout($layout) {
+		if($this->requiresLayout()) {
+			$this->layout = $layout;
+		}
+	} 
+	
+	/**
+	 * Returns this appender layout.
+	 * @see LoggerAppender::getLayout()
+	 * @return LoggerLayout
+	 */
+	public function getLayout() {
+		return $this->layout;
+	}
+	
+	/**
+	 * Configurators call this method to determine if the appender
+	 * requires a layout. 
+	 *
+	 * <p>If this method returns <i>true</i>, meaning that layout is required, 
+	 * then the configurator will configure a layout using the configuration 
+	 * information at its disposal.	 If this method returns <i>false</i>, 
+	 * meaning that a layout is not required, then layout configuration will be
+	 * skipped even if there is available layout configuration
+	 * information at the disposal of the configurator.</p>
+	 *
+	 * <p>In the rather exceptional case, where the appender
+	 * 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() {
+		return $this->requiresLayout;
+	}
+	
+	/**
+	 * Get the name of this appender.
+	 * @see LoggerAppender::getName()
+	 * @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.
+	 *
+	 * 
+	 * @param string $name
+	 */
+	public function setName($name) {
+		$this->name = $name;	
+	}
+	
+	/**
+	 * Returns this appenders threshold level. 
+	 * See the {@link setThreshold()} method for the meaning of this option.
+	 * @return LoggerLevel
+	 */
+	public function getThreshold() { 
+		return $this->threshold;
+	}
+	
+	/**
+	 * Set the threshold level of this appender.
+	 *
+	 * @param mixed $threshold can be a {@link LoggerLevel} object or a string.
+	 * @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;
+		}
+	}
+	
+	/**
+	 * Check 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	
+	 */
+	public function isAsSevereAsThreshold($level) {
+		if($this->threshold === null) {
+			return true;
+		}
+		return $level->isGreaterOrEqual($this->getThreshold());
+	}
 
-    /**
-     * Configurators call this method to determine if the appender
-     * requires a layout. 
-     *
-     * <p>If this method returns <i>true</i>, meaning that layout is required, 
-     * then the configurator will configure a layout using the configuration 
-     * information at its disposal.  If this method returns <i>false</i>, 
-     * meaning that a layout is not required, then layout configuration will be
-     * skipped even if there is available layout configuration
-     * information at the disposal of the configurator.</p>
-     *
-     * <p>In the rather exceptional case, where the appender
-     * implementation admits a layout but can also work without it, then
-     * the appender should return <i>true</i>.</p>
-     *
-     * @return boolean
-     */
-    function requiresLayout()
-    {
-        // override me
-    }
+	/**
+	 * Derived appenders should override this method if option structure
+	 * requires it.
+	 */
+	abstract public function activateOptions();	   
+	
+	/**
+	 * Subclasses of {@link LoggerAppender} 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
+	 */
+	abstract public function close();
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/LoggerAppenderPool.php b/libraries/log4php.debug/LoggerAppenderPool.php
new file mode 100644
index 000000000..9f5f74d26
--- /dev/null
+++ b/libraries/log4php.debug/LoggerAppenderPool.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
+ */
+
+/**
+ * Pool implmentation for LoggerAppender instances
+ *
+ * @version $Revision: 795727 $
+ * @package log4php
+ */
+class LoggerAppenderPool {
+	/* Appender Pool */
+	public static $appenderPool =  null;
+	
+	/**
+	 * 
+	 *
+	 * @param string $name 
+	 * @param string $class 
+	 * @return LoggerAppender
+	 */
+	public static function getAppenderFromPool($name, $class = '') {
+		if(isset(self::$appenderPool[$name])) {
+			return self::$appenderPool[$name];
+		}
+		
+		if(empty($class)) {
+			return null;
+		}
+		
+		$appender = LoggerReflectionUtils::createObject($class);
+		$appender->setName($name);
+		if($appender !== null) { 
+			self::$appenderPool[$name] = $appender;
+			return self::$appenderPool[$name];
+		}
+		return null;		
+	}
+}
diff --git a/libraries/log4php.debug/LoggerAppenderSkeleton.php b/libraries/log4php.debug/LoggerAppenderSkeleton.php
deleted file mode 100644
index a98eff466..000000000
--- a/libraries/log4php.debug/LoggerAppenderSkeleton.php
+++ /dev/null
@@ -1,355 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/LoggerAppender.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-require_once(LOG4PHP_DIR . '/helpers/LoggerOptionConverter.php');
-
-/**
- * Abstract superclass of the other appenders in the package.
- *  
- * This class provides the code for common functionality, such as
- * support for threshold filtering and support for general filters.
- *
- * @author  VxR <vxr@vxr.it>
- * @author  Sergio Strampelli <sergio@ascia.net> 
- * @version $Revision: 1.15 $
- * @package log4php
- * @abstract
- */
-class LoggerAppenderSkeleton extends LoggerAppender {
-
-    /**
-     * @var boolean closed appender flag
-     */
-    var $closed;
-    
-    /**
-     * @var object unused
-     */
-    var $errorHandler;
-           
-    /**
-     * The first filter in the filter chain
-     * @var LoggerFilter
-     */
-    var $headFilter = null;
-            
-    /**
-     * LoggerLayout for this appender. It can be null if appender has its own layout
-     * @var LoggerLayout
-     */
-    var $layout = null; 
-           
-    /**
-     * @var string Appender name
-     */
-    var $name;
-           
-    /**
-     * The last filter in the filter chain
-     * @var LoggerFilter
-     */
-    var $tailFilter = null; 
-           
-    /**
-     * @var LoggerLevel There is no level threshold filtering by default.
-     */
-    var $threshold = null;
-    
-    /**
-     * @var boolean needs a layout formatting ?
-     */
-    var $requiresLayout = false;
-    
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
-    
-    /**
-     * Constructor
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderSkeleton($name)
-    {
-        $this->name = $name;
-        $this->clearFilters();
-    }
-
-    /**
-     * @param LoggerFilter $newFilter add a new LoggerFilter
-     * @see LoggerAppender::addFilter()
-     */
-    function addFilter($newFilter)
-    {
-        if($this->headFilter === null) {
-            $this->headFilter = $newFilter;
-            $this->tailFilter =& $this->headFilter;
-        } else {
-            $this->tailFilter->next = $newFilter;
-            $this->tailFilter =& $this->tailFilter->next;
-        }
-    }
-    
-    /**
-     * Derived appenders should override this method if option structure
-     * requires it.
-     */
-    function activateOptions() 
-    { 
-
-    }
-    
-    /**
-     * Subclasses of {@link LoggerAppenderSkeleton} should implement 
-     * this method to perform actual logging.
-     *
-     * @param LoggerLoggingEvent $event
-     * @see doAppend()
-     * @abstract
-     */
-    function append($event)
-    { 
-        // override me
-    }
- 
-    /**
-     * @see LoggerAppender::clearFilters()
-     */
-    function clearFilters()
-    {
-        unset($this->headFilter);
-        unset($this->tailFilter);
-        $this->headFilter = null;
-        $this->tailFilter = null;
-    }
-           
-    /**
-     * @see LoggerAppender::close()
-     */
-    function close()
-    {
-        //override me
-    }
-            
-    /**
-     * Finalize this appender by calling the derived class' <i>close()</i> method.
-     */
-    function finalize() 
-    {
-        // An appender might be closed then garbage collected. There is no
-        // point in closing twice.
-        if ($this->closed) return;
-        
-        LoggerLog::debug("LoggerAppenderSkeleton::finalize():name=[{$this->name}].");
-        
-        $this->close();
-    }
-    
-    /**
-     * Do not use this method.
-     * @see LoggerAppender::getErrorHandler()
-     * @return object
-     */
-    function &getErrorHandler()
-    {
-        return $this->errorHandler;
-    } 
-           
-    /**
-     * @see LoggerAppender::getFilter()
-     * @return Filter
-     */
-    function &getFilter()
-    {
-        return $this->headFilter;
-    } 
-
-    /** 
-     * Return the first filter in the filter chain for this Appender. 
-     * The return value may be <i>null</i> if no is filter is set.
-     * @return Filter
-     */
-    function &getFirstFilter()
-    {
-        return $this->headFilter;
-    }
-            
-    /**
-     * @see LoggerAppender::getLayout()
-     * @return LoggerLayout
-     */
-    function &getLayout()
-    {
-        return $this->layout;
-    }
-           
-    /**
-     * @see LoggerAppender::getName()
-     * @return string
-     */
-    function getName()
-    {
-        return $this->name;
-    }
-    
-    /**
-     * Returns this appenders threshold level. 
-     * See the {@link setThreshold()} method for the meaning of this option.
-     * @return LoggerLevel
-     */
-    function &getThreshold()
-    { 
-        return $this->threshold;
-    }
-    
-    /**
-     * Check 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 $priority
-     * @return boolean true if priority is greater or equal than threshold  
-     */
-    function isAsSevereAsThreshold($priority)
-    {
-        if ($this->threshold === null)
-            return true;
-            
-        return $priority->isGreaterOrEqual($this->getThreshold());
-    }
-    
-    /**
-     * @see LoggerAppender::doAppend()
-     * @param LoggerLoggingEvent $event
-     */
-    function doAppend($event)
-    {
-        LoggerLog::debug("LoggerAppenderSkeleton::doAppend()"); 
-
-        if ($this->closed) {
-            LoggerLog::debug("LoggerAppenderSkeleton::doAppend() Attempted to append to closed appender named [{$this->name}].");
-            return;
-        }
-        if(!$this->isAsSevereAsThreshold($event->getLevel())) {
-            LoggerLog::debug("LoggerAppenderSkeleton::doAppend() event level is less severe than threshold.");
-            return;
-        }
-
-        $f = $this->getFirstFilter();
-    
-        while($f !== null) {
-            switch ($f->decide($event)) {
-                case LOG4PHP_LOGGER_FILTER_DENY: return;
-                case LOG4PHP_LOGGER_FILTER_ACCEPT: return $this->append($event);
-                case LOG4PHP_LOGGER_FILTER_NEUTRAL: $f = $f->next;
-            }
-        }
-        $this->append($event);    
-    }    
-        
-            
-    /**
-     * @see LoggerAppender::requiresLayout()
-     * @return boolean
-     */
-    function requiresLayout()
-    {
-        return $this->requiresLayout;
-    }
-            
-    /**
-     * @see LoggerAppender::setErrorHandler()
-     * @param object
-     */
-    function setErrorHandler($errorHandler)
-    {
-        if($errorHandler == null) {
-          // We do not throw exception here since the cause is probably a
-          // bad config file.
-            LoggerLog::warn("You have tried to set a null error-handler.");
-        } else {
-            $this->errorHandler = $errorHandler;
-        }
-    } 
-           
-    /**
-     * @see LoggerAppender::setLayout()
-     * @param LoggerLayout $layout
-     */
-    function setLayout($layout)
-    {
-        if ($this->requiresLayout())
-            $this->layout = $layout;
-    } 
- 
-    /**
-     * @see LoggerAppender::setName()
-     * @param string $name
-     */
-    function setName($name) 
-    {
-        $this->name = $name;    
-    }
-    
-    /**
-     * Set the threshold level of this appender.
-     *
-     * @param mixed $threshold can be a {@link LoggerLevel} object or a string.
-     * @see LoggerOptionConverter::toLevel()
-     */
-    function setThreshold($threshold)
-    {
-        if (is_string($threshold)) {
-           $this->threshold = LoggerOptionConverter::toLevel($threshold, null);
-        }elseif (is_a($threshold, 'loggerlevel')) {
-           $this->threshold = $threshold;
-        }
-    }
-    
-    /**
-     * Perform actions before object serialization.
-     *
-     * Call {@link finalize()} to properly close the appender.
-     */
-    function __sleep()
-    {
-        $this->finalize();
-        return array_keys(get_object_vars($this)); 
-    }
-    
-    /**
-     * Perform actions after object deserialization.
-     *
-     * Call {@link activateOptions()} to properly setup the appender.
-     */
-    function __wakeup()
-    {
-        $this->activateOptions();
-    }
-    
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/LoggerBasicConfigurator.php b/libraries/log4php.debug/LoggerBasicConfigurator.php
deleted file mode 100644
index 67e2a4ed1..000000000
--- a/libraries/log4php.debug/LoggerBasicConfigurator.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
-
-require_once(LOG4PHP_DIR . '/spi/LoggerConfigurator.php');
-require_once(LOG4PHP_DIR . '/LoggerLayout.php');
-require_once(LOG4PHP_DIR . '/LoggerAppender.php');
-require_once(LOG4PHP_DIR . '/LoggerManager.php');
-
-/**
- * Use this class to quickly configure the package.
- *
- * <p>For file based configuration see {@link LoggerPropertyConfigurator}. 
- * <p>For XML based configuration see {@link LoggerDOMConfigurator}.
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.2 $
- * @package log4php
- * @since 0.5
- */
-class LoggerBasicConfigurator extends LoggerConfigurator {
-
-    function LoggerBasicConfigurator() 
-    {
-        return;
-    }
-
-    /**
-     * Add a {@link LoggerAppenderConsole} that uses 
-     * the {@link LoggerLayoutTTCC} to the root category.
-     * 
-     * @param string $url not used here
-     * @static  
-     */
-    function configure($url = null)
-    {
-        $root =& LoggerManager::getRootLogger();
-        
-        $appender =& LoggerAppender::singleton('A1', 'LoggerAppenderConsole');
-        $layout = LoggerLayout::factory('LoggerLayoutTTCC');
-        $appender->setLayout($layout);
-
-        $root->addAppender($appender);
-    }
-
-    /**
-     * Reset the default hierarchy to its defaut. 
-     * It is equivalent to
-     * <code>
-     * LoggerManager::resetConfiguration();
-     * </code>
-     *
-     * @see LoggerHierarchy::resetConfiguration()
-     * @static
-     */
-    function resetConfiguration()
-    {
-        LoggerManager::resetConfiguration();
-    }
-}
-?>
diff --git a/libraries/log4php.debug/LoggerCategory.php b/libraries/log4php.debug/LoggerCategory.php
deleted file mode 100644
index 119e95a94..000000000
--- a/libraries/log4php.debug/LoggerCategory.php
+++ /dev/null
@@ -1,572 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/LoggerLevel.php');
-require_once(LOG4PHP_DIR . '/spi/LoggerLoggingEvent.php');
-
-/**
- * This class has been deprecated and replaced by the Logger subclass.
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.17 $
- * @package log4php
- * @see Logger
- */
-class LoggerCategory {
-
-    /**
-     * Additivity is set to true by default, that is children inherit the 
-     * appenders of their ancestors by default.
-     * @var boolean
-     */
-    var $additive       = true;
-    
-    /**
-     * @var string fully qualified class name
-     */  
-    var $fqcn           = 'LoggerCategory';
-
-    /**
-     * @var LoggerLevel The assigned level of this category.
-     */
-    var $level          = null;
-    
-    /**
-     * @var string name of this category.
-     */
-    var $name           = '';
-    
-    /**
-     * @var Logger The parent of this category.
-     */
-    var $parent         = null;
-
-    /**
-     * @var LoggerHierarchy the object repository
-     */
-    var $repository     = null; 
-
-    /**
-     * @var array collection of appenders
-     * @see LoggerAppender
-     */
-    var $aai            = array();
-    
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
-
-    /**
-     * Constructor.
-     *
-     * @param  string  $name  Category name   
-     */
-    function LoggerCategory($name)
-    {
-        $this->name = $name;
-    }
-    
-    /**
-     * Add a new Appender to the list of appenders of this Category instance.
-     *
-     * @param LoggerAppender $newAppender
-     */
-    function addAppender(&$newAppender)
-    {
-        $appenderName = $newAppender->getName();
-        $this->aai[$appenderName] =& $newAppender;
-    } 
-            
-    /**
-     * If assertion parameter is false, then logs msg as an error statement.
-     *
-     * @param bool $assertion
-     * @param string $msg message to log
-     */
-    function assertLog($assertion = true, $msg = '')
-    {
-        if ($assertion == false) {
-            $this->error($msg);
-        }
-    } 
-
-    /**
-     * Call the appenders in the hierarchy starting at this.
-     *
-     * @param LoggerLoggingEvent $event 
-     */
-    function callAppenders($event) 
-    {
-        if (sizeof($this->aai) > 0) {
-            foreach (array_keys($this->aai) as $appenderName) {
-                $this->aai[$appenderName]->doAppend($event);
-            }
-        }
-        if ($this->parent != null and $this->getAdditivity()) {
-            $this->parent->callAppenders($event);
-        }
-    }
-    
-    /**
-     * Log a message object with the DEBUG level including the caller.
-     *
-     * @param mixed $message message
-     * @param mixed $caller caller object or caller string id
-     */
-    function debug($message, $caller = null)
-    {
-        $debugLevel = LoggerLevel::getLevelDebug();
-        if ($this->repository->isDisabled($debugLevel)) {
-            return;
-        }
-        if ($debugLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
-            $this->forcedLog($this->fqcn, $caller, $debugLevel, $message);
-        }
-    } 
-
-    /**
-     * Log a message object with the ERROR level including the caller.
-     *
-     * @param mixed $message message
-     * @param mixed $caller caller object or caller string id
-     */
-    function error($message, $caller = null)
-    {
-        $errorLevel = LoggerLevel::getLevelError();
-        if ($this->repository->isDisabled($errorLevel)) {
-            return;
-        }
-        if ($errorLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
-            $this->forcedLog($this->fqcn, $caller, $errorLevel, $message);
-        }
-    }
-  
-    /**
-     * Deprecated. Please use LoggerManager::exists() instead.
-     *
-     * @param string $name
-     * @see LoggerManager::exists()
-     * @deprecated
-     */
-    function exists($name)
-    {
-        return LoggerManager::exists($name);
-    } 
- 
-    /**
-     * Log a message object with the FATAL level including the caller.
-     *
-     * @param mixed $message message
-     * @param mixed $caller caller object or caller string id
-     */
-    function fatal($message, $caller = null)
-    {
-        $fatalLevel = LoggerLevel::getLevelFatal();
-        if ($this->repository->isDisabled($fatalLevel)) {
-            return;
-        }
-        if ($fatalLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
-            $this->forcedLog($this->fqcn, $caller, $fatalLevel, $message);
-        }
-    } 
-  
-    /**
-     * This method creates a new logging event and logs the event without further checks.
-     *
-     * It should not be called directly. Use {@link info()}, {@link debug()}, {@link warn()},
-     * {@link error()} and {@link fatal()} wrappers.
-     *
-     * @param string $fqcn Fully Qualified Class Name of the Logger
-     * @param mixed $caller caller object or caller string id
-     * @param LoggerLevel $level log level     
-     * @param mixed $message message
-     * @see LoggerLoggingEvent          
-     */
-    function forcedLog($fqcn, $caller, $level, $message)
-    {
-        // $fqcn = is_object($caller) ? get_class($caller) : (string)$caller;
-        $this->callAppenders(new LoggerLoggingEvent($fqcn, $this, $level, $message));
-    } 
-
-    /**
-     * Get the additivity flag for this Category instance.
-     * @return boolean
-     */
-    function getAdditivity()
-    {
-        return $this->additive;
-    }
- 
-    /**
-     * Get the appenders contained in this category as an array.
-     * @return array collection of appenders
-     */
-    function &getAllAppenders() 
-    {
-        $appenders = array();
-        $appenderNames = array_keys($this->aai);
-        $enumAppenders = sizeof($appenderNames);
-        for ($i = 0; $i < $enumAppenders; $i++) {
-            $appenderName = $appenderNames[$i];
-            $appenders[] =& $this->aai[$appenderName];
-        }
-        return $appenders; 
-    }
-    
-    /**
-     * Look for the appender named as name.
-     * @return LoggerAppender
-     */
-    function &getAppender($name) 
-    {
-        return $this->aai[$name];
-    }
-    
-    /**
-     * Please use the {@link getEffectiveLevel()} method instead.
-     * @deprecated
-     */
-    function getChainedPriority()
-    {
-        return $this->getEffectiveLevel();
-    } 
- 
-    /**
-     * Please use {@link LoggerManager::getCurrentLoggers()} instead.
-     * @deprecated
-     */
-    function getCurrentCategories()
-    {
-        return LoggerManager::getCurrentLoggers();
-    } 
- 
-    /**
-     * Please use {@link LoggerManager::getLoggerRepository()} instead.
-     * @deprecated 
-     */
-    function &getDefaultHierarchy()
-    {
-        return LoggerManager::getLoggerRepository();
-    } 
- 
-    /**
-     * @deprecated Use {@link getLoggerRepository()}
-     * @return LoggerHierarchy 
-     */
-    function &getHierarchy()
-    {
-        return $this->getLoggerRepository();
-    } 
-
-    /**
-     * Starting from this category, search the category hierarchy for a non-null level and return it.
-     * @see LoggerLevel
-     * @return LoggerLevel or null
-     */
-    function getEffectiveLevel()
-    {
-        for($c = $this; $c != null; $c = $c->parent) {
-            if($c->level !== null)
-            	return $c->level;
-        }
-        return null;
-    }
-  
-    /**
-     * Retrieve a category with named as the name parameter.
-     * @return Logger
-     */
-    function &getInstance($name)
-    {
-        return LoggerManager::getLogger($name);
-    }
-
-    /**
-     * Returns the assigned Level, if any, for this Category.
-     * @return LoggerLevel or null 
-     */
-    function getLevel()
-    {
-        return $this->level;
-    } 
-
-    /**
-     * Return the the repository where this Category is attached.
-     * @return LoggerHierarchy
-     */
-    function &getLoggerRepository()
-    {
-        return $this->repository;
-    } 
-
-    /**
-     * Return the category name.
-     * @return string
-     */
-    function getName()
-    {
-        return $this->name;
-    } 
-
-    /**
-     * Returns the parent of this category.
-     * @return Logger
-     */
-    function &getParent() 
-    {
-        return $this->parent;
-    }      
-
-    /**
-     * Please use getLevel() instead.
-     * @deprecated
-     */
-    function getPriority()
-    {
-        return $this->getLevel();
-    }
-          
-    /**
-     * Return the inherited ResourceBundle for this category.
-     */
-    function getResourceBundle()
-    {
-        return;
-    } 
-
-    /**
-     * Returns the string resource coresponding to key in this category's inherited resource bundle.
-     */
-    function getResourceBundleString($key)
-    {
-        return;
-    } 
-
-    /**
-     * Return the root of the default category hierrachy.
-     * @return LoggerRoot
-     */
-    function &getRoot()
-    {
-        return LoggerManager::getRootLogger();
-    } 
-
-    /**
-     * Log a message object with the INFO Level.
-     *
-     * @param mixed $message message
-     * @param mixed $caller caller object or caller string id
-     */
-    function info($message, $caller = null)
-    {
-        $infoLevel = LoggerLevel::getLevelInfo();
-        if ($this->repository->isDisabled($infoLevel)) {
-            return;
-        }
-        if ($infoLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
-            $this->forcedLog($this->fqcn, $caller, $infoLevel, $message);
-        }
-    }
-     
-    /**
-     * Is the appender passed as parameter attached to this category?
-     *
-     * @param LoggerAppender $appender
-     */
-    function isAttached($appender)
-    {
-        return in_array($appender->getName(), array_keys($this->aai));
-    } 
-           
-    /**
-     * Check whether this category is enabled for the DEBUG Level.
-     * @return boolean
-     */
-    function isDebugEnabled()
-    {
-        $debugLevel = LoggerLevel::getLevelDebug(); 
-        if ($this->repository->isDisabled($debugLevel)) {
-            return false;
-        }
-        return ($debugLevel->isGreaterOrEqual($this->getEffectiveLevel()));
-    }       
-
-    /**
-     * Check whether this category is enabled for a given Level passed as parameter.
-     *
-     * @param LoggerLevel level
-     * @return boolean
-     */
-    function isEnabledFor($level)
-    {
-        if ($this->repository->isDisabled($level)) {
-            return false;
-        }
-        return (bool)($level->isGreaterOrEqual($this->getEffectiveLevel()));
-    } 
-
-    /**
-     * Check whether this category is enabled for the info Level.
-     * @return boolean
-     * @see LoggerLevel
-     */
-    function isInfoEnabled()
-    {
-        $infoLevel = LoggerLevel::getLevelInfo();
-        if ($this->repository->isDisabled($infoLevel)) {
-            return false;
-        }
-        return ($infoLevel->isGreaterOrEqual($this->getEffectiveLevel()));
-    } 
-
-    /**
-     * Log a localized and parameterized message.
-     */
-    function l7dlog($priority, $key, $params, $t)
-    {
-        return;
-    } 
-
-    /**
-     * This generic form is intended to be used by wrappers.
-     *
-     * @param LoggerLevel $priority a valid level
-     * @param mixed $message message
-     * @param mixed $caller caller object or caller string id
-     */
-    function log($priority, $message, $caller = null)
-    {
-        if ($this->repository->isDisabled($priority)) {
-            return;
-        }
-        if ($priority->isGreaterOrEqual($this->getEffectiveLevel())) {
-            $this->forcedLog($this->fqcn, $caller, $priority, $message);
-        }
-    }
-
-    /**
-     * Remove all previously added appenders from this Category instance.
-     */
-    function removeAllAppenders()
-    {
-        $appenderNames = array_keys($this->aai);
-        $enumAppenders = sizeof($appenderNames);
-        for ($i = 0; $i < $enumAppenders; $i++) {
-            $this->removeAppender($appenderNames[$i]); 
-        }
-    } 
-            
-    /**
-     * Remove the appender passed as parameter form the list of appenders.
-     *
-     * @param mixed $appender can be an appender name or a {@link LoggerAppender} object
-     */
-    function removeAppender($appender)
-    {
-        if (is_a($appender, 'loggerappender')) {
-            $appender->close();
-            unset($this->aai[$appender->getName()]);
-        } elseif (is_string($appender) and isset($this->aai[$appender])) {
-            $this->aai[$appender]->close();
-            unset($this->aai[$appender]);
-        }
-    } 
-
-    /**
-     * Set the additivity flag for this Category instance.
-     *
-     * @param boolean $additive
-     */
-    function setAdditivity($additive) 
-    {
-        $this->additive = (bool)$additive;
-    }
-    
-    /**
-     * @deprecated Please use {@link setLevel()} instead.
-     * @see setLevel()
-     */
-    function setPriority($priority)
-    {
-        $this->setLevel($priority);
-    } 
-
-    /**
-     * Only the Hiearchy class can set the hiearchy of a
-     * category.
-     *
-     * @param LoggerHierarchy &$repository
-     */
-    function setHierarchy(&$repository)
-    {
-        $this->repository =& $repository;
-    }
-
-    /**
-     * Set the level of this Category.
-     *
-     * @param LoggerLevel $level a level string or a level costant 
-     */
-    function setLevel($level)
-    {
-        $this->level = $level;
-    } 
-
-    /**
-     * Set the resource bundle to be used with localized logging methods 
-     */
-    function setResourceBundle($bundle)
-    {
-        return;
-    } 
-           
-    /**
-     * @deprecated use {@link LoggerManager::shutdown()} instead.
-     * @see LoggerManager::shutdown()
-     */
-    function shutdown()
-    {
-        LoggerManager::shutdown();
-    } 
- 
-    /**
-     * Log a message with the WARN level.
-     *
-     * @param mixed $message message
-     * @param mixed $caller caller object or caller string id
-     */
-    function warn($message, $caller = null)
-    {
-        $warnLevel = LoggerLevel::getLevelWarn();
-        if ($this->repository->isDisabled($warnLevel)) {
-            return;
-        }
-        if ($warnLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
-            $this->forcedLog($this->fqcn, $caller, $warnLevel, $message);
-        }
-    }
-
-}  
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/LoggerConfigurator.php b/libraries/log4php.debug/LoggerConfigurator.php
new file mode 100644
index 000000000..192c87a99
--- /dev/null
+++ b/libraries/log4php.debug/LoggerConfigurator.php
@@ -0,0 +1,53 @@
+<?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
+ */
+
+/**
+ * Implemented by classes capable of configuring log4php using a URL.
+ *	
+ * @version $Revision: 822448 $
+ * @package log4php
+ */
+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.  
+	 */
+	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);
+	
+}
diff --git a/libraries/log4php.debug/LoggerDefaultCategoryFactory.php b/libraries/log4php.debug/LoggerDefaultCategoryFactory.php
deleted file mode 100644
index 4962466fa..000000000
--- a/libraries/log4php.debug/LoggerDefaultCategoryFactory.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- */
-
-/**
- * @ignore
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
-
-require_once(LOG4PHP_DIR . '/spi/LoggerFactory.php');
-require_once(LOG4PHP_DIR . '/Logger.php');
-
-/**
- * Creates instances of {@link Logger} with a given name.
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.2 $
- * @package log4php
- * @since 0.5 
- */
-class LoggerDefaultCategoryFactory extends LoggerFactory {
-    
-    function LoggerDefaultCategoryFactory()
-    {
-        return;
-    }    
-    
-    /**
-     * @param string $name
-     * @return Logger
-     */
-    function makeNewLoggerInstance($name)
-    {
-        return new Logger($name);
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/LoggerException.php b/libraries/log4php.debug/LoggerException.php
new file mode 100644
index 000000000..1b9211a40
--- /dev/null
+++ b/libraries/log4php.debug/LoggerException.php
@@ -0,0 +1,28 @@
+<?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
+ */
+
+/**
+ * LoggerException class
+ *
+ * @version $Revision: 771547 $
+ * @package log4php
+ */
+class LoggerException extends Exception {
+}
diff --git a/libraries/log4php.debug/LoggerFilter.php b/libraries/log4php.debug/LoggerFilter.php
new file mode 100644
index 000000000..cd6ce248b
--- /dev/null
+++ b/libraries/log4php.debug/LoggerFilter.php
@@ -0,0 +1,126 @@
+<?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
+ */
+
+/**
+ * Users should extend this class to implement customized logging
+ * event filtering. Note that {@link LoggerCategory} and {@link LoggerAppender}, 
+ * the parent class of all standard
+ * appenders, have built-in filtering rules. It is suggested that you
+ * first use and understand the built-in rules before rushing to write
+ * your own custom filters.
+ * 
+ * <p>This abstract class assumes and also imposes that filters be
+ * organized in a linear chain. The {@link #decide
+ * decide(LoggerLoggingEvent)} method of each filter is called sequentially,
+ * in the order of their addition to the chain.
+ * 
+ * <p>The {@link decide()} method must return one
+ * of the integer constants {@link LoggerFilter::DENY}, 
+ * {@link LoggerFilter::NEUTRAL} or {@link LoggerFilter::ACCEPT}.
+ * 
+ * <p>If the value {@link LoggerFilter::DENY} is returned, then the log event is
+ * dropped immediately without consulting with the remaining
+ * filters. 
+ * 
+ * <p>If the value {@link LoggerFilter::NEUTRAL} is returned, then the next filter
+ * in the chain is consulted. If there are no more filters in the
+ * chain, then the log event is logged. Thus, in the presence of no
+ * filters, the default behaviour is to log all logging events.
+ * 
+ * <p>If the value {@link LoggerFilter::ACCEPT} is returned, then the log
+ * event is logged without consulting the remaining filters. 
+ * 
+ * <p>The philosophy of log4php filters is largely inspired from the
+ * Linux ipchains. 
+ * 
+ * @version $Revision: 822448 $
+ * @package log4php
+ */
+abstract class LoggerFilter {
+
+	/**
+	 * The log event must be logged immediately without consulting with
+	 * the remaining filters, if any, in the chain.	 
+	 */
+	const ACCEPT = 1;
+	
+	/**
+	 * This filter is neutral with respect to the log event. The
+	 * remaining filters, if any, should be consulted for a final decision.
+	 */
+	const NEUTRAL = 0;
+	
+	/**
+	 * The log event must be dropped immediately without consulting
+	 * with the remaining filters, if any, in the chain.  
+	 */
+	const DENY = -1;
+
+	/**
+	 * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain.
+	 */
+	protected $next;
+
+	/**
+	 * Usually filters options become active when set. We provide a
+	 * default do-nothing implementation for convenience.
+	*/
+	public function activateOptions() {
+	}
+
+	/**	  
+	 * Decide what to do.  
+	 * <p>If the decision is {@link LoggerFilter::DENY}, then the event will be
+	 * dropped. If the decision is {@link LoggerFilter::NEUTRAL}, then the next
+	 * filter, if any, will be invoked. If the decision is {@link LoggerFilter::ACCEPT} then
+	 * the event will be logged without consulting with other filters in
+	 * the chain.
+	 *
+	 * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon.
+	 * @return integer {@link LoggerFilter::NEUTRAL} or {@link LoggerFilter::DENY}|{@link LoggerFilter::ACCEPT}
+	 */
+	public function decide(LoggerLoggingEvent $event) {
+		return self::NEUTRAL;
+	}
+
+	/**
+	 * Adds a new filter to the filter chain this filter is a part of.
+	 * If this filter has already and follow up filter, the param filter
+	 * is passed on until it is the last filter in chain.
+	 * 
+	 * @param $filter - the filter to add to this chain
+	 */
+	public function addNext($filter) {
+		if($this->next !== null) {
+		    $this->next->addNext($filter);
+		} else {
+		    $this->next = $filter;
+		}
+	}
+	
+	/**
+	 * Returns the next filter in this chain
+	 * @return the next filter
+	 */
+	public function getNext() {
+		return $this->next;
+	}
+
+}
diff --git a/libraries/log4php.debug/LoggerHierarchy.php b/libraries/log4php.debug/LoggerHierarchy.php
index b3b64e08c..78c55bfd8 100644
--- a/libraries/log4php.debug/LoggerHierarchy.php
+++ b/libraries/log4php.debug/LoggerHierarchy.php
@@ -1,18 +1,20 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
  */
 
@@ -23,16 +25,25 @@ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
 
 /**
  */
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
+//require_once(LOG4PHP_DIR . '/LoggerLog.php');
 require_once(LOG4PHP_DIR . '/LoggerLevel.php');
 require_once(LOG4PHP_DIR . '/LoggerRoot.php');
-require_once(LOG4PHP_DIR . '/or/LoggerRendererMap.php');
-require_once(LOG4PHP_DIR . '/LoggerDefaultCategoryFactory.php');
+require_once(LOG4PHP_DIR . '/renderers/LoggerRendererMap.php');
+//require_once(LOG4PHP_DIR . '/LoggerDefaultCategoryFactory.php');
 
 /**
  * This class is specialized in retrieving loggers by name and also maintaining 
- * the logger hierarchy.
- *
+ * the logger hierarchy. The logger hierarchy is dealing with the several Log-Levels
+ * Logger can have. From log4j website:
+ * 
+ * "A logger is said to be an ancestor of another logger if its name followed 
+ * by a dot is a prefix of the descendant logger name. A logger is said to be
+ * a parent of a child logger if there are no ancestors between itself and the 
+ * descendant logger."
+ * 
+ * Child Loggers do inherit their Log-Levels from their Ancestors. They can
+ * increase their Log-Level compared to their Ancestors, but they cannot decrease it.
+ * 
  * <p>The casual user does not have to deal with this class directly.</p>
  *
  * <p>The structure of the logger hierarchy is maintained by the
@@ -46,343 +57,203 @@ require_once(LOG4PHP_DIR . '/LoggerDefaultCategoryFactory.php');
  * to the provision node. Other descendants of the same ancestor add
  * themselves to the previously created provision node.</p>
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.20 $
+ * @version $Revision: 822448 $
  * @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();
+	
+	/** The root Logger */
+	protected $root = null;
+	
+	/** LoggerRendererMap */
+	protected $rendererMap;
 
-    /**
-     * @var object currently unused
-     */
-    var $defaultFactory;
-    
-    /**
-     * @var boolean activate internal logging
-     * @see LoggerLog
-     */
-    var $debug = false;
-
-    /**
-     * @var array hierarchy tree. saves here all loggers
-     */
-    var $ht = array();
-    
-    /**
-     * @var LoggerRoot
-     */
-    var $root = null;
-    
-    /**
-     * @var LoggerRendererMap
-     */
-    var $rendererMap;
-
-    /**
-     * @var LoggerLevel main level threshold
-     */
-    var $threshold;
-    
-    /**
-     * @var boolean currently unused
-     */
-    var $emittedNoAppenderWarning       = false;
-
-    /**
-     * @var boolean currently unused
-     */
-    var $emittedNoResourceBundleWarning = false;
-    
-    
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
-/* --------------------------------------------------------------------------*/
-
-    function &singleton()
-    {
-        static $instance;
-        
-        if (!isset($instance))
-            $instance = new LoggerHierarchy(new LoggerRoot());
-        return $instance;
-    }
-    
-    /**
-     * Create a new logger hierarchy.
-     * @param object $root the root logger
-     */
-    function LoggerHierarchy($root)
-    {
-        $this->root    =& $root;
-        // Enable all level levels by default.
-        $this->setThreshold(LoggerLevel::getLevelAll());
-        $this->root->setHierarchy($this);
-        $this->rendererMap = new LoggerRendererMap();
-        $this->defaultFactory = new LoggerDefaultCategoryFactory();        
-    }
-     
-    /**
-     * Add a HierarchyEventListener event to the repository. 
-     * Not Yet Impl.
-     */
-    function addHierarchyEventListener($listener)
-    {
-        return;
-    }
-     
-    /**
-     * Add an object renderer for a specific class.
-     * Not Yet Impl.
-     */
-    function addRenderer($classToRender, $or)
-    {
-        $this->rendererMap->put($classToRender, $or);
-    } 
-    
-    /**
-     * This call will clear all logger definitions from the internal hashtable.
-     */
-    function clear()
-    {
-        $this->ht = array();
-    }
-      
-    function emitNoAppenderWarning($cat)
-    {
-        return;
-    }
-    
-    /**
-     * Check if the named logger exists in the hierarchy.
-     * @param string $name
-     * @return boolean
-     */
-    function exists($name)
-    {
-        return in_array($name, array_keys($this->ht));
-    }
+	/** LoggerLevel main level threshold */
+	protected $threshold;
+	
+	/**
+	 * Create a new logger hierarchy.
+	 * @param object $root the root logger
+	 */
+	public function __construct(LoggerRoot $root) {
+		$this->root = $root;
+		$this->setThreshold(LoggerLevel::getLevelAll());
+		$this->rendererMap = new LoggerRendererMap();
+	}
+	 
+	/**
+	 * This call will clear all logger definitions from the internal hashtable.
+	 */
+	public function clear() {
+		$this->ht = array();
+	}
+	  
+	/**
+	 * Check if the named logger exists in the hierarchy.
+	 * @param string $name
+	 * @return boolean
+	 */
+	public function exists($name) {
+		return isset($this->ht[$name]);
+	}
 
-    function fireAddAppenderEvent($logger, $appender)
-    {
-        return;
-    }
-    
-    /**
-     * @deprecated Please use {@link getCurrentLoggers()} instead.
-     */
-    function &getCurrentCategories()
-    {
-        return $this->getCurrentLoggers();
-    }
-    
-    /**
-     * Returns all the currently defined categories in this hierarchy as an array.
-     * @return array
-     */  
-    function &getCurrentLoggers()
-    {
-        $loggers = array();
-        $loggerNames = array_keys($this->ht);
-        $enumLoggers = sizeof($loggerNames);
-        for ($i = 0; $i < $enumLoggers; $i++) {
-            $loggerName = $loggerNames[$i];
-            $loggers[] =& $this->ht[$loggerName];
-        }
-        return $loggers; 
-    }
-    
-    /**
-     * Return a new logger instance named as the first parameter using the default factory.
-     * 
-     * @param string $name logger name
-     * @param LoggerFactory $factory a {@link LoggerFactory} instance or null     
-     * @return Logger
-     */
-    function &getLogger($name, $factory = null)
-    {
-        if ($factory === null) {
-            return $this->getLoggerByFactory($name, $this->defaultFactory);
-        } else {
-            return $this->getLoggerByFactory($name, $factory);
-        }
-    } 
-    
-    /**
-     * Return a new logger instance named as the first parameter using the default factory.
-     * 
-     * @param string $name logger name
-     * @return Logger
-     * @todo merge with {@link getLogger()}
-     */
-    function &getLoggerByFactory($name, $factory)
-    {
-        if (!isset($this->ht[$name])) {
-            LoggerLog::debug("LoggerHierarchy::getLoggerByFactory():name=[$name]:factory=[".get_class($factory)."] creating a new logger...");
-            $this->ht[$name] = $factory->makeNewLoggerInstance($name);
-            $this->ht[$name]->setHierarchy($this);
-            $nodes = explode('.', $name);
-            $firstNode = array_shift($nodes);
-            if ( $firstNode != $name and isset($this->ht[$firstNode])) {
-                LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$firstNode]");            
-                $this->ht[$name]->parent =& $this->ht[$firstNode];
-            } else {
-                LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [root]");            
-                $this->ht[$name]->parent =& $this->root;
-            } 
-            if (sizeof($nodes) > 0) {
-                // find parent node
-                foreach ($nodes as $node) {
-                    $parentNode = "$firstNode.$node";
-                    if (isset($this->ht[$parentNode]) and $parentNode != $name) {
-                        LoggerLog::debug("LoggerHierarchy::getLogger($name) parent is now [$parentNode]");                    
-                        $this->ht[$name]->parent =& $this->ht[$parentNode];
-                    }
-                    $firstNode .= ".$node";
-                }
-            }
-            // update children
-            /*
-            $children = array();
-            foreach (array_keys($this->ht) as $nodeName) {
-                if ($nodeName != $name and substr($nodeName, 0, strlen($name)) == $name) {
-                    $children[] = $nodeName;    
-                }
-            }
-            */
-        }            
-        return $this->ht[$name];
-    }
-    
-    /**
-     * @return LoggerRendererMap Get the renderer map for this hierarchy.
-     */
-    function &getRendererMap()
-    {
-        return $this->rendererMap;
-    }
-    
-    /**
-     * @return LoggerRoot Get the root of this hierarchy.
-     */ 
-    function &getRootLogger()
-    {
-        if (!isset($this->root) or $this->root == null)
-            $this->root = new LoggerRoot();
-        return $this->root;
-    }
-     
-    /**
-     * @return LoggerLevel Returns the threshold Level.
-     */
-    function getThreshold()
-    {
-        return $this->threshold;
-    } 
+	/**
+	 * Returns all the currently defined categories in this hierarchy as an array.
+	 * @return array
+	 */	 
+	public function getCurrentLoggers() {
+		return array_values($this->ht);
+	}
+	
+	/**
+	 * Return a new logger instance named as the first parameter using the default factory.
+	 * 
+	 * @param string $name logger name
+	 * @param LoggerFactory $factory a {@link LoggerFactory} instance or null	  
+	 * @return Logger
+	 */
+	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);
+			$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]);
+			} else {
+				// if there is no father, set root logger as father
+				$this->ht[$name]->setParent($this->root);
+			} 
+		
+			// if there are more nodes than one
+			if(count($nodes) > 0) {
+				// 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]);
+					}
+					$firstNode .= ".$node";
+				}
+			}
+		}		
+		
+		return $this->ht[$name];
+	} 
+	
+	/**
+	 * @return LoggerRendererMap Get the renderer map for this hierarchy.
+	 */
+	public function getRendererMap() {
+		return $this->rendererMap;
+	}
+	
+	/**
+	 * @return LoggerRoot Get the root of this hierarchy.
+	 */ 
+	public function getRootLogger() {
+		if(!isset($this->root) or $this->root == null) {
+			$this->root = new LoggerRoot();
+		}
+		return $this->root;
+	}
+	 
+	/**
+	 * @return LoggerLevel Returns the threshold Level.
+	 */
+	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.
-     * @return boolean
-     */
-    function isDisabled($level)
-    {
-        return ($this->threshold->level > $level->level);
-    }
-    
-    /**
-     * @deprecated Deprecated with no replacement.
-     */
-    function overrideAsNeeded($override)
-    {
-        return;
-    } 
-    
-    /**
-     * 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>,
-     * 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.
-     * 
-     * <p>Existing categories 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>
-     */
-    function resetConfiguration()
-    {
-        $root =& $this->getRootLogger();
-        
-        $root->setLevel(LoggerLevel::getLevelDebug());
-        $this->setThreshold(LoggerLevel::getLevelAll());
-        $this->shutDown();
-        $loggers =& $this->getCurrentLoggers();
-        $enumLoggers = sizeof($loggers);
-        for ($i = 0; $i < $enumLoggers; $i++) {
-            $loggers[$i]->setLevel(null);
-        	$loggers[$i]->setAdditivity(true);
-        	$loggers[$i]->setResourceBundle(null);
-        }
-        $this->rendererMap->clear();
-    }
-      
-    /**
-     * @deprecated Deprecated with no replacement.
-     */
-    function setDisableOverride($override)
-    {
-        return;
-    }
-    
-    /**
-     * Used by subclasses to add a renderer to the hierarchy passed as parameter.
-     * @param string $renderedClass a LoggerRenderer class name
-     * @param LoggerRenderer $renderer
-     *
-     */
-    function setRenderer($renderedClass, $renderer)
-    {
-        $this->rendererMap->put($renderedClass, $renderer);
-    }
-    
-    /**
-     * set a new threshold level
-     *
-     * @param LoggerLevel $l
-     */
-    function setThreshold($l)
-    {
-        if ($l !== null)
-            $this->threshold = $l;
-    }
-    
-    /**
-     * 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.
-     * 
-     * <p>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.
-     */
-    function shutdown()
-    {
-        $this->root->removeAllAppenders();
-        $cats =& $this->getCurrentLoggers();
-        $enumCats = sizeof($cats);        
-        if ($enumCats > 0) {
-            for ($i = 0; $i < $enumCats; $i++) {
-                $cats[$i]->removeAllAppenders();
-            }
-        }
-    }  
+	/**
+	 * This method will return true if this repository is disabled 
+	 * for level object passed as parameter and false otherwise.
+	 * @return boolean
+	 */
+	public function isDisabled(LoggerLevel $level) {
+		return ($this->threshold->toInt() > $level->toInt());
+	}
+	
+	/**
+	 * 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>,
+	 * 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.
+	 * 
+	 * <p>Existing categories 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>
+	 */
+	public function resetConfiguration() {
+		$root = $this->getRootLogger();
+		
+		$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();
+		}
+		$this->rendererMap->clear();
+	}
+	
+	/**
+	 * set a new threshold level
+	 *
+	 * @param LoggerLevel $l
+	 */
+	public function setThreshold(LoggerLevel $l) {
+		if($l !== null) {
+			$this->threshold = $l;
+		}
+	}
+	
+	/**
+	 * 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.
+	 * 
+	 * <p>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.
+	 */
+	public function shutdown() {
+		$this->root->removeAllAppenders();
+		$cats = $this->getCurrentLoggers();
+		$enumCats = count($cats);		  
+		if($enumCats > 0) {
+			for($i = 0; $i < $enumCats; $i++) {
+				$cats[$i]->removeAllAppenders();
+			}
+		}
+	}
 } 
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/LoggerLayout.php b/libraries/log4php.debug/LoggerLayout.php
index a5f774fc6..8261a33e4 100644
--- a/libraries/log4php.debug/LoggerLayout.php
+++ b/libraries/log4php.debug/LoggerLayout.php
@@ -1,18 +1,20 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
  */
 
@@ -23,76 +25,52 @@ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
 
 /**
  * Extend this abstract class to create your own log layout format.
- *  
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.10 $
+ *	
+ * @version $Revision: 822415 $
  * @package log4php
  * @abstract
  */
-class LoggerLayout {
-
-    /**
-     * Creates LoggerLayout instances with the given class name.
-     *
-     * @param string $class
-     * @return LoggerLayout
-     */
-    function factory($class)
-    {
-        if (!empty($class)) {
-            $class = basename($class);
-            if (!class_exists($class))
-                @include_once(LOG4PHP_DIR . "/layouts/{$class}.php");
-            if (class_exists($class))
-                return new $class();
-        }
-        return null;
-    }
-
-    /**
-     * Override this method
-     */
-    function activateOptions() 
-    {
-        // override;
-    }
+abstract class LoggerLayout {
+	/**
+	 * Activates options for this layout.
+	 * Override this method if you have options to be activated.
+	 */
+	public function activateOptions() {
+		return true;
+	}
 
-    /**
-     * Override this method to create your own layout format.
-     *
-     * @param LoggerLoggingEvent
-     * @return string
-     */
-    function format($event)
-    {
-        return $event->getRenderedMessage();
-    } 
-    
-    /**
-     * Returns the content type output by this layout.
-     * @return string
-     */
-    function getContentType()
-    {
-        return "text/plain";
-    } 
-            
-    /**
-     * Returns the footer for the layout format.
-     * @return string
-     */
-    function getFooter()
-    {
-        return null;
-    } 
+	/**
+	 * Override this method to create your own layout format.
+	 *
+	 * @param LoggerLoggingEvent
+	 * @return string
+	 */
+	public function format(LoggerLoggingEvent $event) {
+		return $event->getRenderedMessage();
+	} 
+	
+	/**
+	 * Returns the content type output by this layout.
+	 * @return string
+	 */
+	public function getContentType() {
+		return "text/plain";
+	} 
+			
+	/**
+	 * Returns the footer for the layout format.
+	 * @return string
+	 */
+	public function getFooter() {
+		return null;
+	} 
 
-    /**
-     * Returns the header for the layout format.
-     * @return string
-     */
-    function getHeader()
-    {
-        return null;
-    }
+	/**
+	 * Returns the header for the layout format.
+	 * @return string
+	 */
+	public function getHeader() {
+		return null;
+	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/LoggerLevel.php b/libraries/log4php.debug/LoggerLevel.php
index a3e4803f4..b494ce455 100644
--- a/libraries/log4php.debug/LoggerLevel.php
+++ b/libraries/log4php.debug/LoggerLevel.php
@@ -1,18 +1,20 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
  */
 
@@ -23,242 +25,242 @@ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
  
 /**
  */
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
-define('LOG4PHP_LEVEL_OFF_INT',     2147483647); 
-define('LOG4PHP_LEVEL_FATAL_INT',        50000);
-define('LOG4PHP_LEVEL_ERROR_INT',        40000);
-define('LOG4PHP_LEVEL_WARN_INT',         30000);
-define('LOG4PHP_LEVEL_INFO_INT',         20000);
-define('LOG4PHP_LEVEL_DEBUG_INT',        10000);
-define('LOG4PHP_LEVEL_ALL_INT',    -2147483648);
+//require_once(LOG4PHP_DIR . '/LoggerLog.php');
 
 /**
  * Defines the minimum set of levels recognized by the system, that is
  * <i>OFF</i>, <i>FATAL</i>, <i>ERROR</i>,
- * <i>WARN</i>, <i>INFO</i, <i>DEBUG</i> and
+ * <i>WARN</i>, <i>INFO</i>, <i>DEBUG</i> and
  * <i>ALL</i>.
  *
  * <p>The <i>LoggerLevel</i> class may be subclassed to define a larger
  * level set.</p>
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.11 $
+ * @version $Revision: 884719 $
  * @package log4php
  * @since 0.5
  */
 class LoggerLevel {
+	
+	const OFF = 2147483647;
+	const FATAL = 50000;
+	const ERROR = 40000;
+	const WARN = 30000;
+	const INFO = 20000;
+	const DEBUG = 10000;
+	const ALL = -2147483647;
 
-    /**
-     * @var integer
-     */
-    var $level;
+	/**
+	 * TODO: check if still necessary or to be refactored 
+	 * @var integer
+	 */
+	private $level;
   
-    /**
-     * @var string
-     */
-    var $levelStr;
+  	/**
+   	 * Contains a list of instantiated levels 
+   	 */
+  	private static $levelMap;
+  	
+	/**
+	 * @var string
+	 */
+	private $levelStr;
   
-    /**
-     * @var integer
-     */
-    var $syslogEquivalent;
+	/**
+	 * @var integer
+	 */
+	private $syslogEquivalent;
 
-    /**
-     * Constructor
-     *
-     * @param integer $level
-     * @param string $levelStr
-     * @param integer $syslogEquivalent
-     */
-    function LoggerLevel($level, $levelStr, $syslogEquivalent)
-    {
-        $this->level = $level;
-        $this->levelStr = $levelStr;
-        $this->syslogEquivalent = $syslogEquivalent;
-    }
+	/**
+	 * Constructor
+	 *
+	 * @param integer $level
+	 * @param string $levelStr
+	 * @param integer $syslogEquivalent
+	 */
+	private function __construct($level, $levelStr, $syslogEquivalent) {
+		$this->level = $level;
+		$this->levelStr = $levelStr;
+		$this->syslogEquivalent = $syslogEquivalent;
+	}
 
-    /**
-     * Two priorities are equal if their level fields are equal.
-     *
-     * @param object $o
-     * @return boolean 
-     */
-    function equals($o)
-    {
-        if (is_a($o, 'loggerlevel')) {
-            return ($this->level == $o->level);
-        } else {
-            return false;
-        }
-    }
-    
-    /**
-     * Returns an Off Level
-     * @static
-     * @return LoggerLevel
-     */
-    function &getLevelOff()
-    {
-        static $level;
-        if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_OFF_INT, 'OFF', 0);
-        return $level;
-    }
+	/**
+	 * Two priorities are equal if their level fields are equal.
+	 *
+	 * @param object $o
+	 * @return boolean 
+	 */
+	public function equals($o) {
+		if($o instanceof LoggerLevel) {
+			if($this->level == $o->level) {
+			    return true;
+			}
+		} else {
+			return false;
+		}
+	}
+	
+	/**
+	 * Returns an Off Level
+	 * @static
+	 * @return LoggerLevel
+	 */
+	public static function getLevelOff() {
+		if(!isset(self::$levelMap[LoggerLevel::OFF])) {
+			self::$levelMap[LoggerLevel::OFF] = new LoggerLevel(LoggerLevel::OFF, 'OFF', 0);
+		}
+		return self::$levelMap[LoggerLevel::OFF];
+	}
 
-    /**
-     * Returns a Fatal Level
-     * @static
-     * @return LoggerLevel
-     */
-    function &getLevelFatal()
-    {
-        static $level;
-        if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_FATAL_INT, 'FATAL', 0);
-        return $level;
-    }
-    
-    /**
-     * Returns an Error Level
-     * @static
-     * @return LoggerLevel
-     */
-    function &getLevelError()
-    {
-        static $level;
-        if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ERROR_INT, 'ERROR', 3);
-        return $level;
-    }
-    
-    /**
-     * Returns a Warn Level
-     * @static
-     * @return LoggerLevel
-     */
-    function &getLevelWarn()
-    {
-        static $level;
-        if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_WARN_INT, 'WARN', 4);
-        return $level;
-    }
+	/**
+	 * Returns a Fatal Level
+	 * @static
+	 * @return LoggerLevel
+	 */
+	public static function getLevelFatal() {
+		if(!isset(self::$levelMap[LoggerLevel::FATAL])) {
+			self::$levelMap[LoggerLevel::FATAL] = new LoggerLevel(LoggerLevel::FATAL, 'FATAL', 0);
+		}
+		return self::$levelMap[LoggerLevel::FATAL];
+	}
+	
+	/**
+	 * Returns an Error Level
+	 * @static
+	 * @return LoggerLevel
+	 */
+	public static function getLevelError() {
+		if(!isset(self::$levelMap[LoggerLevel::ERROR])) {
+			self::$levelMap[LoggerLevel::ERROR] = new LoggerLevel(LoggerLevel::ERROR, 'ERROR', 3);
+		}
+		return self::$levelMap[LoggerLevel::ERROR];
+	}
+	
+	/**
+	 * Returns a Warn Level
+	 * @static
+	 * @return LoggerLevel
+	 */
+	public static function getLevelWarn() {
+		if(!isset(self::$levelMap[LoggerLevel::WARN])) {
+			self::$levelMap[LoggerLevel::WARN] = new LoggerLevel(LoggerLevel::WARN, 'WARN', 4);
+		}
+		return self::$levelMap[LoggerLevel::WARN];
+	}
 
-    /**
-     * Returns an Info Level
-     * @static
-     * @return LoggerLevel
-     */
-    function &getLevelInfo()
-    {
-        static $level;
-        if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_INFO_INT, 'INFO', 6);
-        return $level;
-    }
+	/**
+	 * Returns an Info Level
+	 * @static
+	 * @return LoggerLevel
+	 */
+	public static function getLevelInfo() {
+		if(!isset(self::$levelMap[LoggerLevel::INFO])) {
+			self::$levelMap[LoggerLevel::INFO] = new LoggerLevel(LoggerLevel::INFO, 'INFO', 6);
+		}
+		return self::$levelMap[LoggerLevel::INFO];
+	}
 
-    /**
-     * Returns a Debug Level
-     * @static
-     * @return LoggerLevel
-     */
-    function &getLevelDebug()
-    {
-        static $level;
-        if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_DEBUG_INT, 'DEBUG', 7);
-        return $level;
-    }
+	/**
+	 * Returns a Debug Level
+	 * @static
+	 * @return LoggerLevel
+	 */
+	public static function getLevelDebug() {
+		if(!isset(self::$levelMap[LoggerLevel::DEBUG])) {
+			self::$levelMap[LoggerLevel::DEBUG] = new LoggerLevel(LoggerLevel::DEBUG, 'DEBUG', 7);
+		}
+		return self::$levelMap[LoggerLevel::DEBUG];
+	}
 
-    /**
-     * Returns an All Level
-     * @static
-     * @return LoggerLevel
-     */
-    function &getLevelAll()
-    {
-        static $level;
-        if (!isset($level)) $level = new LoggerLevel(LOG4PHP_LEVEL_ALL_INT, 'ALL', 7);
-        return $level;
-    }
-    
-    /**
-     * Return the syslog equivalent of this priority as an integer.
-     * @final
-     * @return integer
-     */
-    function getSyslogEquivalent()
-    {
-        return $this->syslogEquivalent;
-    }
+	/**
+	 * Returns an All Level
+	 * @static
+	 * @return LoggerLevel
+	 */
+	public static function getLevelAll() {
+		if(!isset(self::$levelMap[LoggerLevel::ALL])) {
+			self::$levelMap[LoggerLevel::ALL] = new LoggerLevel(LoggerLevel::ALL, 'ALL', 7);
+		}
+		return self::$levelMap[LoggerLevel::ALL];
+	}
+	
+	/**
+	 * Return the syslog equivalent of this priority as an integer.
+	 * @final
+	 * @return integer
+	 */
+	public function getSyslogEquivalent() {
+		return $this->syslogEquivalent;
+	}
 
-    /**
-     * Returns <i>true</i> if this level has a higher or equal
-     * level than the level passed as argument, <i>false</i>
-     * otherwise.  
-     * 
-     * <p>You should think twice before overriding the default
-     * implementation of <i>isGreaterOrEqual</i> method.
-     *
-     * @param LoggerLevel $r
-     * @return boolean
-     */
-    function isGreaterOrEqual($r)
-    {
-        return $this->level >= $r->level;
-    }
+	/**
+	 * Returns <i>true</i> if this level has a higher or equal
+	 * level than the level passed as argument, <i>false</i>
+	 * otherwise.  
+	 * 
+	 * <p>You should think twice before overriding the default
+	 * implementation of <i>isGreaterOrEqual</i> method.
+	 *
+	 * @param LoggerLevel $r
+	 * @return boolean
+	 */
+	public function isGreaterOrEqual($r) {
+		return $this->level >= $r->level;
+	}
 
-    /**
-     * Returns the string representation of this priority.
-     * @return string
-     * @final
-     */
-    function toString()
-    {
-        return $this->levelStr;
-    }
+	/**
+	 * Returns the string representation of this priority.
+	 * @return string
+	 * @final
+	 */
+	public function toString() {
+		return $this->levelStr;
+	}
 
-    /**
-     * Returns the integer representation of this level.
-     * @return integer
-     */
-    function toInt()
-    {
-        return $this->level;
-    }
+	/**
+	 * Returns the integer representation of this level.
+	 * @return integer
+	 */
+	public function toInt() {
+		return $this->level;
+	}
 
-    /**
-     * Convert the string passed as argument to a level. If the
-     * conversion fails, then this method returns a DEBUG Level.
-     *
-     * @param mixed $arg
-     * @param LoggerLevel $default
-     * @static 
-     */
-    function &toLevel($arg, $defaultLevel = null)
-    {
-        if ($defaultLevel === null) {
-            return LoggerLevel::toLevel($arg, LoggerLevel::getLevelDebug());
-        } else {
-            if (is_int($arg)) {
-                switch($arg) {
-                    case LOG4PHP_LEVEL_ALL_INT:     return LoggerLevel::getLevelAll();
-                    case LOG4PHP_LEVEL_DEBUG_INT:   return LoggerLevel::getLevelDebug();
-                    case LOG4PHP_LEVEL_INFO_INT:    return LoggerLevel::getLevelInfo();
-                    case LOG4PHP_LEVEL_WARN_INT:    return LoggerLevel::getLevelWarn();
-                    case LOG4PHP_LEVEL_ERROR_INT:   return LoggerLevel::getLevelError();
-                    case LOG4PHP_LEVEL_FATAL_INT:   return LoggerLevel::getLevelFatal();
-                    case LOG4PHP_LEVEL_OFF_INT:     return LoggerLevel::getLevelOff();
-                    default:                        return $defaultLevel;
-                }
-            } else {
-                switch(strtoupper($arg)) {
-                    case 'ALL':     return LoggerLevel::getLevelAll();
-                    case 'DEBUG':   return LoggerLevel::getLevelDebug();
-                    case 'INFO':    return LoggerLevel::getLevelInfo();
-                    case 'WARN':    return LoggerLevel::getLevelWarn();
-                    case 'ERROR':   return LoggerLevel::getLevelError();
-                    case 'FATAL':   return LoggerLevel::getLevelFatal();
-                    case 'OFF':     return LoggerLevel::getLevelOff();
-                    default:        return $defaultLevel;
-                }
-            }
-        }
-    }
+	/**
+	 * Convert the string passed as argument to a level. If the
+	 * conversion fails, then this method returns a DEBUG Level.
+	 *
+	 * @param mixed $arg
+	 * @param LoggerLevel $default
+	 * @static 
+	 */
+	public static function toLevel($arg, $defaultLevel = null) {
+		if($defaultLevel === null) {
+			return self::toLevel($arg, self::getLevelDebug());
+		} else {
+			if(is_int($arg)) {
+				switch($arg) {
+					case self::ALL:	return self::getLevelAll();
+					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 '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;
+				}
+			}
+		}
+	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/LoggerLocationInfo.php b/libraries/log4php.debug/LoggerLocationInfo.php
new file mode 100644
index 000000000..6138590fa
--- /dev/null
+++ b/libraries/log4php.debug/LoggerLocationInfo.php
@@ -0,0 +1,110 @@
+<?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 internal representation of caller location information.
+ *
+ * @version $Revision: 822448 $
+ * @package log4php
+ * @since 0.3
+ */
+class LoggerLocationInfo {
+	/**
+	 * When location information is not available the constant
+	 * <i>NA</i> is returned. Current value of this string
+	 * constant is <b>?</b>.  
+	 */
+	const LOCATION_INFO_NA = 'NA';
+	
+	/**
+	* @var string Caller's line number.
+	*/
+	protected $lineNumber = null;
+	
+	/**
+	* @var string Caller's file name.
+	*/
+	protected $fileName = null;
+	
+	/**
+	* @var string Caller's fully qualified class name.
+	*/
+	protected $className = null;
+	
+	/**
+	* @var string Caller's method name.
+	*/
+	protected $methodName = null;
+	
+	/**
+	* @var string 
+	*/
+	protected $fullInfo = null;
+
+	/**
+	 * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
+	 *
+	 * @param array $trace
+	 * @param mixed $caller
+	 */
+	public function __construct($trace, $fqcn = null) {
+		$this->lineNumber = isset($trace['line']) ? $trace['line'] : null;
+		$this->fileName = isset($trace['file']) ? $trace['file'] : null;
+		$this->className = isset($trace['class']) ? $trace['class'] : null;
+		$this->methodName = isset($trace['function']) ? $trace['function'] : null;
+		$this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . 
+			'(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
+	}
+
+	public function getClassName() {
+		return ($this->className === null) ? self::LOCATION_INFO_NA : $this->className; 
+	}
+
+	/**
+	 *	Return the file name of the caller.
+	 *	<p>This information is not always available.
+	 */
+	public function getFileName() {
+		return ($this->fileName === null) ? self::LOCATION_INFO_NA : $this->fileName; 
+	}
+
+	/**
+	 *	Returns the line number of the caller.
+	 *	<p>This information is not always available.
+	 */
+	public function getLineNumber() {
+		return ($this->lineNumber === null) ? self::LOCATION_INFO_NA : $this->lineNumber; 
+	}
+
+	/**
+	 *	Returns the method name of the caller.
+	 */
+	public function getMethodName() {
+		return ($this->methodName === null) ? self::LOCATION_INFO_NA : $this->methodName; 
+	}
+
+	/**
+	 *	Returns the full information of the caller.
+	 */
+	public function getFullInfo() {
+		return ($this->fullInfo === null) ? self::LOCATION_INFO_NA : $this->fullInfo;
+	}
+
+}
diff --git a/libraries/log4php.debug/LoggerLog.php b/libraries/log4php.debug/LoggerLog.php
deleted file mode 100644
index 558129e97..000000000
--- a/libraries/log4php.debug/LoggerLog.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__)); 
-
-/**
- * Helper class for internal logging
- *
- * <p>It uses php {@link PHP_MANUAL#trigger_error trigger_error()} function
- * to output messages.</p>
- * <p>You need to recode methods to output messages in a different way.</p> 
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.9 $
- * @package log4php
- */
-class LoggerLog {
-
-    /**
-     * Log if debug is enabled.
-     *
-     * Log using php {@link PHP_MANUAL#trigger_error trigger_error()} function 
-     * with E_USER_NOTICE level by default.
-     *
-     * @param string $message log message
-     * @param integer $errLevel level to log
-     * @static
-     */
-    function log($message, $errLevel = E_USER_NOTICE)
-    {
-        if (LoggerLog::internalDebugging())
-            trigger_error($message, $errLevel);
-    }
-    
-    function internalDebugging($value = null)
-    {
-        static $debug = false;
-
-        if (is_bool($value))
-            $debug = $value;
-        return $debug;
-    }
-    
-    /**
-     * Report a debug message. 
-     *
-     * @param string $message log message
-     * @static
-     * @since 0.3
-     */
-    function debug($message)
-    {
-        LoggerLog::log($message, E_USER_NOTICE);
-    }
-    
-    /**
-     * Report an error message. 
-     *
-     * @param string $message log message
-     * @static
-     * @since 0.3
-     */
-    function error($message)
-    {
-        trigger_error($message, E_USER_ERROR);
-    }
-    
-    /**
-     * Report a warning message. 
-     *
-     * @param string $message log message
-     * @static
-     * @since 0.3
-     */
-    function warn($message)
-    {
-        trigger_error($message, E_USER_WARNING);
-    }
-
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/LoggerLoggingEvent.php b/libraries/log4php.debug/LoggerLoggingEvent.php
new file mode 100644
index 000000000..4c545a17e
--- /dev/null
+++ b/libraries/log4php.debug/LoggerLoggingEvent.php
@@ -0,0 +1,360 @@
+<?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 internal representation of logging event.
+ *
+ * @version $Revision: 832662 $
+ * @package log4php
+ */
+class LoggerLoggingEvent {
+
+	private static $startTime;
+
+	/** 
+	* @var string Fully Qualified Class Name of the calling category class.
+	*/
+	private $fqcn;
+	
+	/**
+	* @var Logger reference
+	*/
+	private $logger = null;
+	
+	/** 
+	* The category (logger) name.
+	* This field will be marked as private in future
+	* releases. Please do not access it directly. 
+	* Use the {@link getLoggerName()} method instead.
+	* @deprecated 
+	*/
+	private $categoryName;
+	
+	/** 
+	* Level of logging event.
+	* <p> This field should not be accessed directly. You shoud use the
+	* {@link getLevel()} method instead.
+	*
+	* @deprecated
+	* @var LoggerLevel
+	*/
+	protected $level;
+	
+	/** 
+	 * @var string The nested diagnostic context (NDC) of logging event. 
+	 */
+	private $ndc;
+	
+	/** 
+	 * Have we tried to do an NDC lookup? If we did, there is no need
+	 * to do it again.	Note that its value is always false when
+	 * serialized. Thus, a receiving SocketNode will never use it's own
+	 * (incorrect) NDC. See also writeObject method.
+	 * @var boolean
+	 */
+	private $ndcLookupRequired = true;
+	
+	/** 
+	 * Have we tried to do an MDC lookup? If we did, there is no need
+	 * to do it again.	Note that its value is always false when
+	 * serialized. See also the getMDC and getMDCCopy methods.
+	 * @var boolean	 
+	 */
+	private $mdcCopyLookupRequired = true;
+	
+	/** 
+	 * @var mixed The application supplied message of logging event. 
+	 */
+	private $message;
+	
+	/** 
+	 * The application supplied message rendered through the log4php
+	 * objet rendering mechanism. At present renderedMessage == message.
+	 * @var string
+	 */
+	private $renderedMessage = null;
+	
+	/** 
+	 * The name of thread in which this logging event was generated.
+	 * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} 
+	 * @var mixed
+	 */
+	private $threadName = null;
+	
+	/** 
+	* The number of seconds elapsed from 1/1/1970 until logging event
+	* was created plus microseconds if available.
+	* @var float
+	*/
+	public $timeStamp;
+	
+	/** 
+	* @var LoggerLocationInfo Location information for the caller. 
+	*/
+	private $locationInfo = null;
+	
+	/**
+	* Instantiate a LoggingEvent from the supplied parameters.
+	*
+	* <p>Except {@link $timeStamp} all the other fields of
+	* LoggerLoggingEvent are filled when actually needed.
+	*
+	* @param string $fqcn name of the caller class.
+	* @param mixed $logger The {@link Logger} category of this event or the logger name.
+	* @param LoggerLevel $priority The level of this event.
+	* @param mixed $message The message of this event.
+	* @param integer $timeStamp the timestamp of this logging event.
+	*/
+	public function __construct($fqcn, $logger, $priority, $message, $timeStamp = null) {
+		$this->fqcn = $fqcn;
+		if($logger instanceof Logger) {
+			$this->logger = $logger;
+			$this->categoryName = $logger->getName();
+		} else {
+			$this->categoryName = strval($logger);
+		}
+		$this->level = $priority;
+		$this->message = $message;
+		if($timeStamp !== null && is_float($timeStamp)) {
+			$this->timeStamp = $timeStamp;
+		} else {
+			if(function_exists('microtime')) {
+				// get microtime as float
+				$this->timeStamp = microtime(true);
+			} else {
+				$this->timeStamp = floatval(time());
+			}
+		}
+	}
+
+	/**
+	 * Set the location information for this logging event. The collected
+	 * information is cached for future use.
+	 *
+	 * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
+	 * to collect informations about caller.</p>
+	 * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
+	 * @return LoggerLocationInfo
+	 */
+	public function getLocationInformation() {
+		if($this->locationInfo === null) {
+
+			$locationInfo = array();
+
+			if(function_exists('debug_backtrace')) {
+				$trace = debug_backtrace();
+				$prevHop = null;
+				// make a downsearch to identify the caller
+				$hop = array_pop($trace);
+				while($hop !== null) {
+					if(isset($hop['class'])) {
+						// we are sometimes in functions = no class available: avoid php warning here
+						$className = strtolower($hop['class']);
+						if(!empty($className) and ($className == 'logger' or $className == 'loggercategory' or 
+							strtolower(get_parent_class($className)) == 'logger' or
+							strtolower(get_parent_class($className)) == 'loggercategory')) {
+							$locationInfo['line'] = $hop['line'];
+							$locationInfo['file'] = $hop['file'];
+							break;
+						}
+					}
+					$prevHop = $hop;
+					$hop = array_pop($trace);
+				}
+				$locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
+				if(isset($prevHop['function']) and
+					$prevHop['function'] !== 'include' and
+					$prevHop['function'] !== 'include_once' and
+					$prevHop['function'] !== 'require' and
+					$prevHop['function'] !== 'require_once') {
+	
+					$locationInfo['function'] = $prevHop['function'];
+				} else {
+					$locationInfo['function'] = 'main';
+				}
+			}
+					 
+			$this->locationInfo = new LoggerLocationInfo($locationInfo, $this->fqcn);
+		}
+		return $this->locationInfo;
+	}
+
+	/**
+	 * Return the level of this event. Use this form instead of directly
+	 * accessing the {@link $level} field.
+	 * @return LoggerLevel	
+	 */
+	public function getLevel() {
+		return $this->level;
+	}
+
+	/**
+	 * Return the name of the logger. Use this form instead of directly
+	 * accessing the {@link $categoryName} field.
+	 * @return string  
+	 */
+	public function getLoggerName() {
+		return $this->categoryName;
+	}
+
+	/**
+	 * Return the message for this logging event.
+	 *
+	 * <p>Before serialization, the returned object is the message
+	 * passed by the user to generate the logging event. After
+	 * serialization, the returned value equals the String form of the
+	 * message possibly after object rendering.
+	 * @return mixed
+	 */
+	public function getMessage() {
+		if($this->message !== null) {
+			return $this->message;
+		} else {
+			return $this->getRenderedMessage();
+		}
+	}
+
+	/**
+	 * This method returns the NDC for this event. It will return the
+	 * correct content even if the event was generated in a different
+	 * thread or even on a different machine. The {@link LoggerNDC::get()} method
+	 * should <b>never</b> be called directly.
+	 * @return string  
+	 */
+	public function getNDC() {
+		if($this->ndcLookupRequired) {
+			$this->ndcLookupRequired = false;
+			$this->ndc = implode(' ', LoggerNDC::get());
+		}
+		return $this->ndc;
+	}
+
+	/**
+	 * Returns the the context corresponding to the <code>key</code>
+	 * parameter.
+	 * @return string
+	 */
+	public function getMDC($key) {
+		return LoggerMDC::get($key);
+	}
+
+	/**
+	 * Render message.
+	 * @return string
+	 */
+	public function getRenderedMessage() {
+		if($this->renderedMessage === null and $this->message !== null) {
+			if(is_string($this->message)) {
+					$this->renderedMessage = $this->message;
+			} else {
+			    // $this->logger might be null or an instance of Logger or RootLogger
+			    // But in contrast to log4j, in log4php there is only have one LoggerHierarchy so there is
+			    // no need figure out which one is $this->logger part of.
+			    // TODO: Logger::getHierarchy() is marked @deprecated!
+				$repository = Logger::getHierarchy();
+				$rendererMap = $repository->getRendererMap();
+				$this->renderedMessage= $rendererMap->findAndRender($this->message);
+			}
+		}
+		return $this->renderedMessage;
+	}
+
+	/**
+	 * 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)) {
+			if (function_exists('microtime')) {
+				// microtime as float
+				self::$startTime = microtime(true);
+			} else {
+				self::$startTime = floatval(time());
+			}
+		}
+		return self::$startTime; 
+	}
+
+	/**
+	 * @return float
+	 */
+	public function getTimeStamp() {
+		return $this->timeStamp;
+	}
+	
+	/**
+	 * Calculates the time of this event.
+	 * @return the time after event starttime when this event has occured
+	 */
+	public function getTime() {
+        $eventTime = (float)$this->getTimeStamp();
+        $eventStartTime = (float)LoggerLoggingEvent::getStartTime();
+        return number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
+    }
+	
+	/**
+	 * @return mixed
+	 */
+	public function getThreadName() {
+		if ($this->threadName === null) {
+			$this->threadName = (string)getmypid();
+		}
+		return $this->threadName;
+	}
+
+	/**
+	 * @return mixed null
+	 */
+	public function getThrowableInformation() {
+		return null;
+	}
+	
+	/**
+	 * Serialize this object
+	 * @return string
+	 */
+	public function toString() {
+		serialize($this);
+	}
+	
+	/**
+	 * Avoid serialization of the {@link $logger} object
+	 */
+	public function __sleep() {
+		return array(
+			'fqcn',
+			'categoryName',
+			'level',
+			'ndc',
+			'ndcLookupRequired',
+			'message',
+			'renderedMessage',
+			'threadName',
+			'timeStamp',
+			'locationInfo',
+		);
+	}
+
+}
+
+LoggerLoggingEvent::getStartTime();
diff --git a/libraries/log4php.debug/LoggerMDC.php b/libraries/log4php.debug/LoggerMDC.php
index 9ebca41f3..788723ec1 100644
--- a/libraries/log4php.debug/LoggerMDC.php
+++ b/libraries/log4php.debug/LoggerMDC.php
@@ -1,129 +1,117 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
  */
 
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__)); 
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
-
-define('LOGGER_MDC_HT_SIZE', 7);
-
 /**
  * This is the global repository of user mappings
  */
 $GLOBALS['log4php.LoggerMDC.ht'] = array();
 
 /**
- * The LoggerMDC class is similar to the {@link LoggerNDC} class except that it is
- * based on a map instead of a stack. It provides <i>mapped diagnostic contexts</i>.
+ * The LoggerMDC class provides <i>mapped diagnostic contexts</i>.
  * 
- * A <i>Mapped Diagnostic Context</i>, or
+ * <p>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 
+ * 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 ../../examples/php/mdc.php 19}<br>
  *
- * <p><b><i>The MDC is managed on a per thread basis</i></b>.
+ * With the properties file:
+ * 
+ * {@example ../../examples/resources/mdc.properties 18}<br>
  * 
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.4 $
+ * Will result in the following (notice the username "knut" in the output):
+ * 
+ * <pre>
+ * 2009-09-13 18:48:28 DEBUG root knut: Testing MDC in src/examples/php/mdc.php at 23
+ * </pre>
+ * 
+ * @version $Revision: 883114 $
  * @since 0.3
  * @package log4php
  */
 class LoggerMDC {
+	/**
+	 * 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>
+	 *
+	 * @param string $key the key
+	 * @param string $value the value
+	 * @static
+	 */
+	public static function put($key, $value) {
+		$GLOBALS['log4php.LoggerMDC.ht'][$key] = $value;
+	}
   
-    /**
-     * 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 LOGGER_MDC_HT_SIZE} keys.</p>
-     *
-     * @param string $key the key
-     * @param string $value the value
-     * @static
-     */
-    function put($key, $value)
-    {
-        if ( sizeof($GLOBALS['log4php.LoggerMDC.ht']) < LOGGER_MDC_HT_SIZE ) 
-            $GLOBALS['log4php.LoggerMDC.ht'][$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>
-     *
-     * <p>This method has no side effects.</p>
-     *
-     * @param string $key
-     * @return string
-     * @static
-     */
-    function get($key)
-    {
-        LoggerLog::debug("LoggerMDC::get() key='$key'");
-    
-        if (!empty($key)) {
-            if (strpos($key, 'server.') === 0) {
-                $varName = substr($key, 7);
-                
-                LoggerLog::debug("LoggerMDC::get() a _SERVER[$varName] is requested.");
-                
-                return $_SERVER[$varName];
-            } elseif (strpos($key, 'env.') === 0) {
-
-                $varName = substr($key, 4);
-                
-                LoggerLog::debug("LoggerMDC::get() a _ENV[$varName] is requested.");
-                
-                return $_ENV[$varName];
-            } elseif (isset($GLOBALS['log4php.LoggerMDC.ht'][$key])) {
-            
-                LoggerLog::debug("LoggerMDC::get() a user key is requested.");
-            
-                return $GLOBALS['log4php.LoggerMDC.ht'][$key];
-            }
-        }
-        return '';
-    }
+	/**
+	 * 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>
+	 *
+	 * <p>This method has no side effects.</p>
+	 *
+	 * @param string $key
+	 * @return string
+	 * @static
+	 */
+	public static function get($key) {
+		if(!empty($key)) {
+			if(strpos($key, 'server.') === 0) {
+				$varName = substr($key, 7);
+				return @$_SERVER[$varName];
+			} else if(strpos($key, 'env.') === 0) {
+				$varName = substr($key, 4);
+				return @$_ENV[$varName];
+			} else if (isset($GLOBALS['log4php.LoggerMDC.ht'][$key])) {
+				return $GLOBALS['log4php.LoggerMDC.ht'][$key];
+			}
+		}
+		return '';
+	}
 
-    /**
-     * Remove the the context identified by the key parameter. 
-     *
-     * It only affects user mappings.
-     *
-     * @param string $key
-     * @return string
-     * @static
-     */
-    function remove($key)
-    {
-        unset($GLOBALS['log4php.LoggerMDC.ht'][$key]);
-    }
+	/**
+	 * Remove the the context identified by the key parameter. 
+	 *
+	 * It only affects user mappings.
+	 *
+	 * @param string $key
+	 * @return string
+	 * @static
+	 */
+	public static function remove($key) {
+		unset($GLOBALS['log4php.LoggerMDC.ht'][$key]);
+	}
 
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/LoggerManager.php b/libraries/log4php.debug/LoggerManager.php
deleted file mode 100644
index cd208fcf0..000000000
--- a/libraries/log4php.debug/LoggerManager.php
+++ /dev/null
@@ -1,262 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- */
-
-/**
- * LOG4PHP_DIR points to the log4php root directory.
- *
- * If not defined it will be set automatically when the first package classfile 
- * is included
- * 
- * @var string 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
-
-require_once(LOG4PHP_DIR . '/LoggerHierarchy.php');
-
-/**
- * Use the LoggerManager to get Logger instances.
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.18 $
- * @package log4php
- * @see Logger
- * @todo create a configurator selector  
- */
-class LoggerManager {
-
-    /**
-     * check if a given logger exists.
-     * 
-     * @param string $name logger name 
-     * @static
-     * @return boolean
-     */
-    function exists($name)
-    {
-        $repository =& LoggerManager::getLoggerRepository();
-        return $repository->exists($name);
-    }
-
-    /**
-     * Returns an array this whole Logger instances.
-     * 
-     * @static
-     * @see Logger
-     * @return array
-     */
-    function getCurrentLoggers()
-    {
-        $repository =& LoggerManager::getLoggerRepository();
-        return $repository->getCurrentLoggers();
-    }
-    
-    /**
-     * Returns the root logger.
-     * 
-     * @static
-     * @return object
-     * @see LoggerRoot
-     */
-    function &getRootLogger()
-    {
-        $repository =& LoggerManager::getLoggerRepository();
-        return $repository->getRootLogger();
-    }
-    
-    /**
-     * Returns the specified Logger.
-     * 
-     * @param string $name logger name
-     * @param LoggerFactory $factory a {@link LoggerFactory} instance or null
-     * @static
-     * @return Logger
-     */
-    function &getLogger($name, $factory = null)
-    {
-        $repository =& LoggerManager::getLoggerRepository();
-        return $repository->getLogger($name, $factory);
-    }
-    
-    /**
-     * Returns the LoggerHierarchy.
-     * 
-     * @static
-     * @return LoggerHierarchy
-     */
-    function &getLoggerRepository()
-    {
-        return LoggerHierarchy::singleton();    
-    }
-    
-
-    /**
-     * Destroy loggers object tree.
-     * 
-     * @static
-     * @return boolean 
-     */
-    function resetConfiguration()
-    {
-        $repository =& LoggerManager::getLoggerRepository();    
-        return $repository->resetConfiguration();    
-    }
-    
-    /**
-     * Does nothing.
-     * @static
-     */
-    function setRepositorySelector($selector, $guard)
-    {
-        return;
-    }
-    
-    /**
-     * Safely close all appenders.
-     * @static
-     */
-    function shutdown()
-    {
-        $repository =& LoggerManager::getLoggerRepository();    
-        return $repository->shutdown();    
-    }
-}
-
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-// ---------------------------------------------------------------------------
-
-if (!defined('LOG4PHP_DEFAULT_INIT_OVERRIDE')) {
-    if (isset($_ENV['log4php.defaultInitOverride'])) {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_DEFAULT_INIT_OVERRIDE', 
-            LoggerOptionConverter::toBoolean($_ENV['log4php.defaultInitOverride'], false)
-        );
-    } elseif (isset($GLOBALS['log4php.defaultInitOverride'])) {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_DEFAULT_INIT_OVERRIDE', 
-            LoggerOptionConverter::toBoolean($GLOBALS['log4php.defaultInitOverride'], false)
-        );
-    } else {
-        /**
-         * Controls init execution
-         *
-         * With this constant users can skip the default init procedure that is
-         * called when this file is included.
-         *
-         * <p>If it is not user defined, log4php tries to autoconfigure using (in order):</p>
-         *
-         * - the <code>$_ENV['log4php.defaultInitOverride']</code> variable.
-         * - the <code>$GLOBALS['log4php.defaultInitOverride']</code> global variable.
-         * - defaults to <i>false</i>
-         *
-         * @var boolean
-         */
-        define('LOG4PHP_DEFAULT_INIT_OVERRIDE', false);
-    }
-}
-
-if (!defined('LOG4PHP_CONFIGURATION')) {
-    if (isset($_ENV['log4php.configuration'])) {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_CONFIGURATION', trim($_ENV['log4php.configuration']));
-    } else {
-        /**
-         * Configuration file.
-         *
-         * <p>This constant tells configurator classes where the configuration
-         * file is located.</p>
-         * <p>If not set by user, log4php tries to set it automatically using 
-         * (in order):</p>
-         *
-         * - the <code>$_ENV['log4php.configuration']</code> enviroment variable.
-         * - defaults to 'log4php.properties'.
-         *
-         * @var string
-         */
-        define('LOG4PHP_CONFIGURATION', 'log4php.properties');
-    }
-}
-
-if (!defined('LOG4PHP_CONFIGURATOR_CLASS')) {
-    if ( strtolower(substr( LOG4PHP_CONFIGURATION, -4 )) == '.xml') { 
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_CONFIGURATOR_CLASS', LOG4PHP_DIR . '/xml/LoggerDOMConfigurator');
-    } else {
-        /**
-         * Holds the configurator class name.
-         *
-         * <p>This constant is set with the fullname (path included but non the 
-         * .php extension) of the configurator class that init procedure will use.</p>
-         * <p>If not set by user, log4php tries to set it automatically.</p>
-         * <p>If {@link LOG4PHP_CONFIGURATION} has '.xml' extension set the 
-         * constants to '{@link LOG4PHP_DIR}/xml/{@link LoggerDOMConfigurator}'.</p>
-         * <p>Otherwise set the constants to 
-         * '{@link LOG4PHP_DIR}/{@link LoggerPropertyConfigurator}'.</p>
-         *
-         * <p><b>Security Note</b>: classfile pointed by this constant will be brutally
-         * included with a:
-         * <code>@include_once(LOG4PHP_CONFIGURATOR_CLASS . ".php");</code></p>
-         *
-         * @var string
-         */
-        define('LOG4PHP_CONFIGURATOR_CLASS', LOG4PHP_DIR . '/LoggerPropertyConfigurator');
-    }
-}
-
-if (!LOG4PHP_DEFAULT_INIT_OVERRIDE) {
-    if (!LoggerManagerDefaultInit())
-        LoggerLog::warn("LOG4PHP main() Default Init failed.");
-}
-
-/**
- * Default init procedure.
- *
- * <p>This procedure tries to configure the {@link LoggerHierarchy} using the
- * configurator class defined via {@link LOG4PHP_CONFIGURATOR_CLASS} that tries
- * to load the configurator file defined in {@link LOG4PHP_CONFIGURATION}.
- * If something goes wrong a warn is raised.</p>
- * <p>Users can skip this procedure using {@link LOG4PHP_DEFAULT_INIT_OVERRIDE}
- * constant.</p> 
- *
- * @return boolean
- */
-function LoggerManagerDefaultInit()
-{
-    $configuratorClass = basename(LOG4PHP_CONFIGURATOR_CLASS);
-    if (!class_exists($configuratorClass)) {
-        @include_once(LOG4PHP_CONFIGURATOR_CLASS . ".php");
-    }
-    if (class_exists($configuratorClass)) {
-        
-        return call_user_func(array($configuratorClass, 'configure'), LOG4PHP_CONFIGURATION);         
-
-    } else {
-        LoggerLog::warn("LoggerManagerDefaultInit() Configurator '{$configuratorClass}' doesnt exists");
-        return false;
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/LoggerNDC.php b/libraries/log4php.debug/LoggerNDC.php
index ac94ee43e..48d7b61b2 100644
--- a/libraries/log4php.debug/LoggerNDC.php
+++ b/libraries/log4php.debug/LoggerNDC.php
@@ -1,18 +1,20 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
  */
 
@@ -23,9 +25,6 @@ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
  
 /**
  */
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
-define('LOGGER_NDC_HT_SIZE', 7);
 
 /**
  * This is the global repository of NDC stack
@@ -33,208 +32,198 @@ define('LOGGER_NDC_HT_SIZE', 7);
 $GLOBALS['log4php.LoggerNDC.ht'] = array();
 
 /**
- * This is the max depth of NDC stack
- */
-$GLOBALS['log4php.LoggerNDC.maxDepth'] = LOGGER_NDC_HT_SIZE;
-
-
-/**
- * The NDC class implements <i>nested diagnostic contexts</i> as
- * defined by Neil Harrison in the article "Patterns for Logging
- * Diagnostic Messages" part of the book "<i>Pattern Languages of
- * Program Design 3</i>" edited by Martin et al.
+ * The NDC class implements <i>nested diagnostic contexts</i>.
+ * 
+ * NDC was defined by Neil Harrison in the article "Patterns for Logging
+ * Diagnostic Messages" part of the book <i>"Pattern Languages of
+ * Program Design 3"</i> edited by Martin et al.
  *
- * <p>A Nested Diagnostic Context, or NDC in short, is an instrument
+ * A Nested Diagnostic Context, or NDC in short, is an instrument
  * to distinguish interleaved log output from different sources. Log
  * output is typically interleaved when a server handles multiple
  * clients near-simultaneously.
  *
- * <p>Interleaved log output can still be meaningful if each log entry
+ * This class is similar to the {@link LoggerMDC} class except that it is
+ * based on a stack instead of a map.
+ *
+ * Interleaved log output can still be meaningful if each log entry
  * from different contexts had a distinctive stamp. This is where NDCs
  * come into play.
  *
- * <p><i><b>Note that NDCs are managed on a per thread
- * basis</b></i>. NDC operations such as {@link push()}, {@link pop()}, 
+ * <b>Note that NDCs are managed on a per thread basis</b>. 
+ * 
+ * NDC operations such as {@link push()}, {@link pop()}, 
  * {@link clear()}, {@link getDepth()} and {@link setMaxDepth()}
  * affect the NDC of the <i>current</i> thread only. NDCs of other
  * threads remain unaffected.
  *
- * <p>For example, a servlet can build a per client request NDC
+ * For example, a servlet can build a per client request NDC
  * consisting the clients host name and other information contained in
  * the the request. <i>Cookies</i> are another source of distinctive
  * information. To build an NDC one uses the {@link push()}
- * operation.</p>
+ * operation.
  * 
  * Simply put,
  *
  * - Contexts can be nested.
- * - When entering a context, call 
- *   <code>LoggerNDC::push()</code>
- *   As a side effect, if there is no nested diagnostic context for the
- *   current thread, this method will create it.
- * - When leaving a context, call 
- *   <code>LoggerNDC::pop()</code>
+ * - When entering a context, call <kbd>LoggerNDC::push()</kbd>
+ *	 As a side effect, if there is no nested diagnostic context for the
+ *	 current thread, this method will create it.
+ * - When leaving a context, call <kbd>LoggerNDC::pop()</kbd>
  * - <b>When exiting a thread make sure to call {@link remove()}</b>
- *   
- * <p>There is no penalty for forgetting to match each
- * <code>push</code> operation with a corresponding <code>pop</code>,
+ *	 
+ * There is no penalty for forgetting to match each
+ * <kbd>push</kbd> operation with a corresponding <kbd>pop</kbd>,
  * except the obvious mismatch between the real application context
- * and the context set in the NDC.</p>
+ * and the context set in the NDC.
  *
- * <p>If configured to do so, {@link LoggerPatternLayout} and {@link LoggerLayoutTTCC} 
+ * If configured to do so, {@link LoggerPatternLayout} and {@link LoggerLayoutTTCC} 
  * instances automatically retrieve the nested diagnostic
  * context for the current thread without any user intervention.
  * Hence, even if a servlet is serving multiple clients
  * simultaneously, the logs emanating from the same code (belonging to
  * the same category) can still be distinguished because each client
- * request will have a different NDC tag.</p>
+ * request will have a different NDC tag.
+ *
+ * Example:
+ *	
+ * {@example ../../examples/php/ndc.php 19}<br>
  *
- *  
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.5 $
+ * With the properties file:
+ * 
+ * {@example ../../examples/resources/ndc.properties 18}<br>
+ * 
+ * Will result in the following (notice the conn and client ids):
+ * 
+ * <pre>
+ * 2009-09-13 19:04:27 DEBUG root conn=1234: just received a new connection in src/examples/php/ndc.php at 23
+ * 2009-09-13 19:04:27 DEBUG root conn=1234 client=ab23: some more messages that can in src/examples/php/ndc.php at 25
+ * 2009-09-13 19:04:27 DEBUG root conn=1234 client=ab23: now related to a client in src/examples/php/ndc.php at 26
+ * 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: 883114 $
  * @package log4php 
  * @since 0.3
  */
 class LoggerNDC {
+	const HT_SIZE = 7;
+	/**
+	 * Clear any nested diagnostic information if any. This method is
+	 * useful in cases where the same thread can be potentially used
+	 * over and over in different unrelated contexts.
+	 *
+	 * <p>This method is equivalent to calling the {@link setMaxDepth()}
+	 * method with a zero <var>maxDepth</var> argument.
+	 *
+	 * @static	
+	 */
+	public static function clear() {
+		$GLOBALS['log4php.LoggerNDC.ht'] = array();
+	}
 
-    /**
-     * Clear any nested diagnostic information if any. This method is
-     * useful in cases where the same thread can be potentially used
-     * over and over in different unrelated contexts.
-     *
-     * <p>This method is equivalent to calling the {@link setMaxDepth()}
-     * method with a zero <var>maxDepth</var> argument.
-     *
-     * @static  
-     */
-    function clear()
-    {
-        LoggerLog::debug("LoggerNDC::clear()");
-        
-        $GLOBALS['log4php.LoggerNDC.ht'] = array();
-    }
-
-    /**
-     * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead.
-     * @static
-     * @return array
-     */
-    function get()
-    {
-        LoggerLog::debug("LoggerNDC::get()");
-    
-        return $GLOBALS['log4php.LoggerNDC.ht'];
-    }
+	/**
+	 * Never use this method directly, use the {@link LoggerLoggingEvent::getNDC()} method instead.
+	 * @static
+	 * @return array
+	 */
+	public static function get() {
+		if(!array_key_exists('log4php.LoggerNDC.ht', $GLOBALS)) {
+			LoggerNDC::clear();
+		}
+		return $GLOBALS['log4php.LoggerNDC.ht'];
+	}
   
-    /**
-     * Get the current nesting depth of this diagnostic context.
-     *
-     * @see setMaxDepth()
-     * @return integer
-     * @static
-     */
-    function getDepth()
-    {
-        LoggerLog::debug("LoggerNDC::getDepth()");
-    
-        return sizeof($GLOBALS['log4php.LoggerNDC.ht']);      
-    }
+	/**
+	 * Get the current nesting depth of this diagnostic context.
+	 *
+	 * @see setMaxDepth()
+	 * @return integer
+	 * @static
+	 */
+	public static function getDepth() {
+		return count($GLOBALS['log4php.LoggerNDC.ht']);	  
+	}
 
-    /**
-     * Clients should call this method before leaving a diagnostic
-     * context.
-     *
-     * <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
-     */
-    function pop()
-    {
-        LoggerLog::debug("LoggerNDC::pop()");
-    
-        if (sizeof($GLOBALS['log4php.LoggerNDC.ht']) > 0) {
-            return array_pop($GLOBALS['log4php.LoggerNDC.ht']);
-        } else {
-            return '';
-        }
-    }
+	/**
+	 * Clients should call this method before leaving a diagnostic
+	 * context.
+	 *
+	 * <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 pop() {
+		if(count($GLOBALS['log4php.LoggerNDC.ht']) > 0) {
+			return array_pop($GLOBALS['log4php.LoggerNDC.ht']);
+		} else {
+			return '';
+		}
+	}
 
-    /**
-     * Looks at the last diagnostic context at the top of this NDC
-     * without removing it.
-     *
-     * <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
-     */
-    function peek()
-    {
-        LoggerLog::debug("LoggerNDC::peek()");
-    
-        if (sizeof($GLOBALS['log4php.LoggerNDC.ht']) > 0) {
-            return end($GLOBALS['log4php.LoggerNDC.ht']);
-        } else {
-            return '';
-        }
-    }
+	/**
+	 * Looks at the last diagnostic context at the top of this NDC
+	 * without removing it.
+	 *
+	 * <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($GLOBALS['log4php.LoggerNDC.ht']) > 0) {
+			return end($GLOBALS['log4php.LoggerNDC.ht']);
+		} else {
+			return '';
+		}
+	}
   
-    /**
-     * Push new diagnostic context information for the current thread.
-     *
-     * <p>The contents of the <var>message</var> parameter is
-     * determined solely by the client.
-     *  
-     * @param string $message The new diagnostic context information.
-     * @static  
-     */
-    function push($message)
-    {
-        LoggerLog::debug("LoggerNDC::push()");
-    
-        array_push($GLOBALS['log4php.LoggerNDC.ht'], (string)$message);
-    }
+	/**
+	 * Push new diagnostic context information for the current thread.
+	 *
+	 * <p>The contents of the <var>message</var> parameter is
+	 * determined solely by the client.
+	 *	
+	 * @param string $message The new diagnostic context information.
+	 * @static	
+	 */
+	public static function push($message) {
+		array_push($GLOBALS['log4php.LoggerNDC.ht'], (string)$message);
+	}
 
-    /**
-     * Remove the diagnostic context for this thread.
-     * @static
-     */
-    function remove()
-    {
-        LoggerLog::debug("LoggerNDC::remove()");
-    
-        LoggerNDC::clear();
-    }
+	/**
+	 * Remove the diagnostic context for this thread.
+	 * @static
+	 */
+	public static function remove() {
+		LoggerNDC::clear();
+	}
+
+	/**
+	 * Set maximum depth of this diagnostic context. If the current
+	 * depth is smaller or equal to <var>maxDepth</var>, then no
+	 * action is taken.
+	 *
+	 * <p>This method is a convenient alternative to multiple 
+	 * {@link pop()} calls. Moreover, it is often the case that at 
+	 * the end of complex call sequences, the depth of the NDC is
+	 * unpredictable. The {@link setMaxDepth()} method circumvents
+	 * this problem.
+	 *
+	 * @param integer $maxDepth
+	 * @see getDepth()
+	 * @static
+	 */
+	public static function setMaxDepth($maxDepth) {
+		$maxDepth = (int)$maxDepth;
+		if($maxDepth <= self::HT_SIZE) {
+			if(LoggerNDC::getDepth() > $maxDepth) {
+				$GLOBALS['log4php.LoggerNDC.ht'] = array_slice($GLOBALS['log4php.LoggerNDC.ht'], $maxDepth);
+			}
+		}
+	}
 
-    /**
-     * Set maximum depth of this diagnostic context. If the current
-     * depth is smaller or equal to <var>maxDepth</var>, then no
-     * action is taken.
-     *
-     * <p>This method is a convenient alternative to multiple 
-     * {@link pop()} calls. Moreover, it is often the case that at 
-     * the end of complex call sequences, the depth of the NDC is
-     * unpredictable. The {@link setMaxDepth()} method circumvents
-     * this problem.
-     *
-     * @param integer $maxDepth
-     * @see getDepth()
-     * @static
-     */
-    function setMaxDepth($maxDepth)
-    {
-        LoggerLog::debug("LoggerNDC::setMaxDepth() maxDepth='$maxDepth'");
-    
-        $maxDepth = (int)$maxDepth;
-        if ($maxDepth <= LOGGER_NDC_HT_SIZE) {
-            if (LoggerNDC::getDepth() > $maxDepth) {
-                $GLOBALS['log4php.LoggerNDC.ht'] = array_slice($GLOBALS['log4php.LoggerNDC.ht'], $maxDepth);
-            }
-            $GLOBALS['log4php.LoggerNDC.maxDepth'] = $maxDepth;            
-        }
-    }
-  
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/LoggerPropertyConfigurator.php b/libraries/log4php.debug/LoggerPropertyConfigurator.php
deleted file mode 100644
index 989643949..000000000
--- a/libraries/log4php.debug/LoggerPropertyConfigurator.php
+++ /dev/null
@@ -1,650 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- */
-
-/**
- * @ignore
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
-
-require_once(LOG4PHP_DIR . '/config/LoggerPropertySetter.php');
-require_once(LOG4PHP_DIR . '/helpers/LoggerOptionConverter.php');
-require_once(LOG4PHP_DIR . '/or/LoggerObjectRenderer.php');
-require_once(LOG4PHP_DIR . '/or/LoggerRendererMap.php');
-require_once(LOG4PHP_DIR . '/spi/LoggerConfigurator.php');
-require_once(LOG4PHP_DIR . '/spi/LoggerFilter.php');
-require_once(LOG4PHP_DIR . '/LoggerAppender.php');
-require_once(LOG4PHP_DIR . '/LoggerDefaultCategoryFactory.php');
-require_once(LOG4PHP_DIR . '/LoggerLayout.php');
-require_once(LOG4PHP_DIR . '/LoggerLevel.php');
-require_once(LOG4PHP_DIR . '/LoggerManager.php');
-
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX',      "log4php.category.");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX',        "log4php.logger.");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_FACTORY_PREFIX',       "log4php.factory");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ADDITIVITY_PREFIX',    "log4php.additivity.");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_CATEGORY_PREFIX', "log4php.rootCategory");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_LOGGER_PREFIX',   "log4php.rootLogger");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_APPENDER_PREFIX',      "log4php.appender.");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_RENDERER_PREFIX',      "log4php.renderer.");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_THRESHOLD_PREFIX',     "log4php.threshold");
-
-/** 
- * Key for specifying the {@link LoggerFactory}.  
- */
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_FACTORY_KEY',   "log4php.loggerFactory");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_DEBUG_KEY',     "log4php.debug");
-define('LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_INTERNAL_ROOT_NAME',   "root");
-
-
-
-/**
- * Allows the configuration of log4php from an external file.
- * 
- * See {@link doConfigure()} for the expected format.
- * 
- * <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>LoggerPropertyConfigurator</i> does not handle the
- * advanced configuration features supported by the {@link LoggerDOMConfigurator} 
- * such as support for {@link LoggerFilter}, 
-   custom {@link LoggerErrorHandlers}, nested appenders such as the 
-   {@link Logger AsyncAppender}, 
- * etc.
- * 
- * <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>&quot;${&quot;</b> and
- * closing <b>&quot;}&quot;</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>
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.6 $
- * @package log4php
- * @since 0.5 
- */
-class LoggerPropertyConfigurator extends LoggerConfigurator {
-
-    /**
-     * @var LoggerFactory
-     */
-    var $loggerFactory = null;
-    
-    /**
-     * Constructor
-     */
-    function LoggerPropertyConfigurator()
-    {
-        $this->loggerFactory = new LoggerDefaultCategoryFactory();
-    }
-    
-    /**
-     * Configure the default repository 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
-     * @return boolean configuration result
-     * @static
-     */
-    function configure($url = '')
-    {
-        $configurator = new LoggerPropertyConfigurator();
-        $repository =& LoggerManager::getLoggerRepository();
-        return $configurator->doConfigure($url, $repository);
-    }
-
-    /**
-     * 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  LoggerManager::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 LoggerObjectRenderer}
-     * 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 SyslogAppender
-     * log4php.appender.A1=SyslogAppender
-     * 
-     * ; The syslog daemon resides on www.abc.net
-     * log4php.appender.A1.SyslogHost=www.abc.net
-     * 
-     * ; 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
-     */
-    function doConfigure($url, &$repository)
-    {
-        $properties = @parse_ini_file($url);
-        if ($properties === false) {
-            LoggerLog::warn("LoggerPropertyConfigurator::doConfigure() cannot load '$url' configuration.");
-            return false; 
-        }
-        return $this->doConfigureProperties($properties, $repository);
-    }
-
-
-    /**
-     * Read configuration options from <b>properties</b>.
-     *
-     * @see doConfigure().
-     * @param array $properties
-     * @param LoggerHierarchy &$hierarchy
-     */
-    function doConfigureProperties($properties, &$hierarchy)
-    {
-        $value = @$properties[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_DEBUG_KEY];
-        
-        if (!empty($value)) {
-            LoggerLog::internalDebugging(LoggerOptionConverter::toBoolean($value, LoggerLog::internalDebugging()));
-        }
-
-        $thresholdStr = @$properties[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_THRESHOLD_PREFIX];
-        $hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
-        
-        $this->configureRootCategory($properties, $hierarchy);
-        $this->configureLoggerFactory($properties);
-        $this->parseCatsAndRenderers($properties, $hierarchy);
-
-        LoggerLog::debug("LoggerPropertyConfigurator::doConfigureProperties() Finished configuring.");
-        
-        return true;
-    }
-
-    // --------------------------------------------------------------------------
-    // Internal stuff
-    // --------------------------------------------------------------------------
-
-    /**
-     * Check the provided <b>Properties</b> object for a
-     * {@link LoggerFactory} entry specified by 
-     * {@link LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_FACTORY_KEY}.
-     *  
-     * If such an entry exists, an attempt is made to create an instance using 
-     * the default constructor.  
-     * This instance is used for subsequent Category creations
-     * within this configurator.
-     *
-     * @see parseCatsAndRenderers()
-     * @param array $props array of properties
-     */
-    function configureLoggerFactory($props)
-    {
-        $factoryFqcn = @$props[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_FACTORY_KEY];
-        if(!empty($factoryFqcn)) {
-            $factoryClassName = basename($factoryFqcn);
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::configureLoggerFactory() Trying to load factory [" .
-                $factoryClassName . 
-                "]."
-            );
-            
-            if (!class_exists($factoryClassName))
-                @include_once("{$factoryFqcn}.php");
-            if (class_exists($factoryClassName)) {
-                $loggerFactory = new $factoryClassName();
-            } else {
-                LoggerLog::debug(
-                    "LoggerPropertyConfigurator::configureLoggerFactory() Unable to load factory [" .
-                    $factoryClassName . 
-                    "]. Using default."
-                );
-                $loggerFactory = $this->loggerFactory;
-            }
-
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::configureLoggerFactory() ".
-                "Setting properties for category factory [" . get_class($loggerFactory) . "]."
-            );
-            
-            LoggerPropertySetter::setPropertiesByObject($loggerFactory, $props, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_FACTORY_PREFIX . ".");
-        }
-    }
-    
-    /**
-     * @param array $props array of properties
-     * @param LoggerHierarchy &$hierarchy
-     */
-    function configureRootCategory($props, &$hierarchy)
-    {
-        $effectivePrefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_LOGGER_PREFIX;
-        $value = @$props[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_LOGGER_PREFIX];
-
-        if(empty($value)) {
-            $value = @$props[LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_CATEGORY_PREFIX];
-            $effectivePrefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ROOT_CATEGORY_PREFIX;
-        }
-
-        if (empty($value)) {
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::configureRootCategory() ".
-                "Could not find root logger information. Is this OK?"
-            );
-        } else {
-            $root =& $hierarchy->getRootLogger();
-            // synchronized(root) {
-        	$this->parseCategory(
-                $props, 
-                $root, 
-                $effectivePrefix, 
-                LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_INTERNAL_ROOT_NAME, 
-                $value
-            );
-            // }
-        }
-    }
-
-    /**
-     * Parse non-root elements, such non-root categories and renderers.
-     *
-     * @param array $props array of properties
-     * @param LoggerHierarchy &$hierarchy
-     */
-    function parseCatsAndRenderers($props, &$hierarchy)
-    {
-        while(list($key,$value) = each($props)) {
-            if( strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX) === 0 or 
-                strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX) === 0) {
-	            if(strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX) === 0) {
-                    $loggerName = substr($key, strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_CATEGORY_PREFIX));
-	            } elseif (strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX) === 0) {
-                    $loggerName = substr($key, strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_LOGGER_PREFIX));
-                }
-                $logger =& $hierarchy->getLogger($loggerName, $this->loggerFactory);
-	            // synchronized(logger) {
-	            $this->parseCategory($props, $logger, $key, $loggerName, $value);
-        	    $this->parseAdditivityForLogger($props, $logger, $loggerName);
-	            // }
-            } elseif (strpos($key, LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_RENDERER_PREFIX) === 0) {
-                $renderedClass = substr($key, strlen(LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_RENDERER_PREFIX));
-	            $renderingClass = $value;
-            	if (method_exists($hierarchy, 'addrenderer')) {
-	                LoggerRendererMap::addRenderer($hierarchy, $renderedClass, $renderingClass);
-                }
-	        }
-        }
-    }
-
-    /**
-     * Parse the additivity option for a non-root category.
-     *
-     * @param array $props array of properties
-     * @param Logger &$cat
-     * @param string $loggerName
-     */
-    function parseAdditivityForLogger($props, &$cat, $loggerName)
-    {
-        $value = LoggerOptionConverter::findAndSubst(
-                    LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ADDITIVITY_PREFIX . $loggerName,
-					$props
-                 );
-        LoggerLog::debug(
-            "LoggerPropertyConfigurator::parseAdditivityForLogger() ".
-            "Handling " . LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_ADDITIVITY_PREFIX . $loggerName . "=[{$value}]"
-        );
-        // touch additivity only if necessary
-        if(!empty($value)) {
-            $additivity = LoggerOptionConverter::toBoolean($value, true);
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::parseAdditivityForLogger() ".
-                "Setting additivity for [{$loggerName}] to [{$additivity}]"
-            );
-            $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
-     */
-    function &parseCategory($props, &$logger, $optionKey, $loggerName, $value)
-    {
-        LoggerLog::debug(
-            "LoggerPropertyConfigurator::parseCategory() ".
-            "Parsing for [{$loggerName}] with value=[{$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(!(@$value{0} == ',' || empty($value))) {
-            // just to be on the safe side...
-            if(sizeof($st) == 0)
-	            return;
-                
-            $levelStr = current($st);
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::parseCategory() ".
-                "Level token is [$levelStr]."
-            );
-
-            // 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 == LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_INTERNAL_ROOT_NAME) {
-                    LoggerLog::warn(
-                        "LoggerPropertyConfigurator::parseCategory() ".
-                        "The root logger cannot be set to null."
-                    );
-	            } else {
-	                $logger->setLevel(null);
-	            }
-            } else {
-	            $logger->setLevel(LoggerOptionConverter::toLevel($levelStr, LoggerLevel::getLevelDebug()));
-            }
-        }
-
-        // Begin by removing all existing appenders.
-        $logger->removeAllAppenders();
-        while($appenderName = next($st)) {
-            $appenderName = trim($appenderName);
-            if(empty($appenderName))
-                continue;
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::parseCategory() ".
-                "Parsing appender named [{$appenderName}]."
-            );
-            $appender =& $this->parseAppender($props, $appenderName);
-            if($appender !== null) {
-	            $logger->addAppender($appender);
-            }
-        }
-    }
-
-    /**
-     * @param array $props array of properties
-     * @param string $appenderName
-     * @return LoggerAppender
-     */
-    function &parseAppender($props, $appenderName)
-    {
-        $appender =& LoggerAppender::singleton($appenderName);
-        if($appender !== null) {
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::parseAppender() ".
-                "Appender [{$appenderName}] was already parsed."
-            );
-            return $appender;
-        }
-        // Appender was not previously initialized.
-        $prefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_APPENDER_PREFIX . $appenderName;
-        $layoutPrefix = $prefix . ".layout";
-        $appenderClass = @$props[$prefix];
-        if (!empty($appenderClass)) {
-            $appender =& LoggerAppender::singleton($appenderName, $appenderClass);
-            if($appender === null) {
-                LoggerLog::warn(
-                    "LoggerPropertyConfigurator::parseAppender() ".
-                    "Could not instantiate appender named [$appenderName]."
-                );
-                return null;
-            }
-        } else {
-            LoggerLog::warn(
-                "LoggerPropertyConfigurator::parseAppender() ".
-                "Could not instantiate appender named [$appenderName] with null className."
-            );
-            return null;
-        }
-        
-        $appender->setName($appenderName);
-        if( $appender->requiresLayout() ) {
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::parseAppender() ".
-                "Parsing layout section for [$appenderName]."
-            );
-            $layoutClass = @$props[$layoutPrefix];
-            $layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
-            if (empty($layoutClass)) {
-                LoggerLog::warn(
-                    "LoggerPropertyConfigurator::parseAppender() ".
-                    "layout class is empty in '$layoutPrefix'. Using Simple layout"
-                );
-                $layout = LoggerLayout::factory('LoggerLayoutSimple');
-            } else {
-        	    $layout = LoggerLayout::factory($layoutClass);
-                
-	            if($layout === null) {
-	                LoggerLog::warn(
-                        "LoggerPropertyConfigurator::parseAppender() ".
-                        "cannot create layout '$layoutClass'. Using Simple layout"
-                    );
-                    $layout = LoggerLayout::factory('LoggerLayoutSimple');
-                }
-            }
-            
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::parseAppender() ".
-                "Parsing layout options for [$appenderName]."
-            );
-            LoggerPropertySetter::setPropertiesByObject($layout, $props, $layoutPrefix . ".");                
-            LoggerLog::debug(
-                "LoggerPropertyConfigurator::parseAppender() ".
-                "End Parsing layout options for [$appenderName]."
-            );
-            $appender->setLayout($layout);
-            
-        }
-        LoggerPropertySetter::setPropertiesByObject($appender, $props, $prefix . ".");
-        LoggerLog::debug(
-            "LoggerPropertyConfigurator::parseAppender() ".        
-            "Parsed [{$appenderName}] options."
-        );
-        return $appender;        
-    }
-
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/LoggerReflectionUtils.php b/libraries/log4php.debug/LoggerReflectionUtils.php
new file mode 100644
index 000000000..8a8c0db3c
--- /dev/null
+++ b/libraries/log4php.debug/LoggerReflectionUtils.php
@@ -0,0 +1,154 @@
+<?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
+ */
+ 
+ /**
+  * Provides methods for reflective use on php objects
+  * @package log4php
+  */
+class LoggerReflectionUtils {
+		/** the target object */
+	private $obj;
+  
+	/**
+	 * Create a new LoggerReflectionUtils for the specified Object. 
+	 * This is done in prepartion for invoking {@link setProperty()} 
+	 * one or more times.
+	 * @param object &$obj the object for which to set properties
+	 */
+	public function __construct($obj) {
+		$this->obj = $obj;
+	}
+  
+	/**
+	 * Set the properties of an object passed as a parameter in one
+	 * go. The <code>properties</code> are parsed relative to a
+	 * <code>prefix</code>.
+	 *
+	 * @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) {
+		$pSetter = new LoggerReflectionUtils($obj);
+		return $pSetter->setProperties($properties, $prefix);
+	}
+  
+
+	/**
+	 * Set the properites for the object that match the
+	 * <code>prefix</code> passed as parameter.
+	 * 
+	 * Example:
+	 * 
+	 * $arr['xxxname'] = 'Joe';
+ 	 * $arr['xxxmale'] = true;
+	 * and prefix xxx causes setName and setMale.	
+	 *
+	 * @param array $properties An array containing keys and values.
+	 * @param string $prefix Only keys having the specified prefix will be set.
+	 */
+	 // TODO: check, if this is really useful
+	public function setProperties($properties, $prefix) {
+		$len = strlen($prefix);
+		while(list($key,) = each($properties)) {
+			if(strpos($key, $prefix) === 0) {
+				if(strpos($key, '.', ($len + 1)) > 0) {
+					continue;
+				}
+				$value = LoggerOptionConverter::findAndSubst($key, $properties);
+				$key = substr($key, $len);
+				if($key == 'layout' and ($this->obj instanceof LoggerAppender)) {
+					continue;
+				}
+				$this->setProperty($key, $value);
+			}
+		}
+		$this->activate();
+	}
+	
+	/**
+	 * Set a property on this PropertySetter's Object. If successful, this
+	 * method will invoke a setter method on the underlying Object. The
+	 * setter is the one for the specified property name and the value is
+	 * determined partly from the setter argument type and partly from the
+	 * value specified in the call to this method.
+	 *
+	 * <p>If the setter expects a String no conversion is necessary.
+	 * If it expects an int, then an attempt is made to convert 'value'
+	 * to an int using new Integer(value). If the setter expects a boolean,
+	 * the conversion is by new Boolean(value).
+	 *
+	 * @param string $name	  name of the property
+	 * @param string $value	  String value of the property
+	 */
+	public function setProperty($name, $value) {
+		if($value === null) {
+			return;
+		}
+		
+		$method = "set" . ucfirst($name);
+		
+		if(!method_exists($this->obj, $method)) {
+			throw new Exception("Error setting log4php property $name to $value: no method $method in class ".get_class($this->obj)."!");
+		} else {
+			return call_user_func(array($this->obj, $method), $value);
+		} 
+	}
+  
+	public function activate() {
+		if(method_exists($this->obj, 'activateoptions')) {
+			return call_user_func(array($this->obj, 'activateoptions'));
+		} 
+	}
+	
+	/**
+	 * Creates an instances from the given class name.
+	 *
+	 * @param string $classname
+	 * @return an object from the class with the given classname
+	 */
+	public static function createObject($class) {
+		if(!empty($class)) {
+			$class = basename($class);
+			return new $class();
+		}
+		return null;
+	}
+	
+	/**
+     * @param object $object
+     * @param string $name
+     * @param mixed $value
+     */
+    public static function setter($object, $name, $value) {
+        if (empty($name)) {
+            return false;
+        }
+        $methodName = 'set'.ucfirst($name);
+        if (method_exists($object, $methodName)) {
+            return call_user_func(array($object, $methodName), $value);
+        } else {
+            return false;
+        }
+    }
+	
+}
diff --git a/libraries/log4php.debug/LoggerRoot.php b/libraries/log4php.debug/LoggerRoot.php
index c25a401bc..d1b8ff35c 100644
--- a/libraries/log4php.debug/LoggerRoot.php
+++ b/libraries/log4php.debug/LoggerRoot.php
@@ -1,101 +1,71 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
  */
 
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/Logger.php');
-require_once(LOG4PHP_DIR . '/LoggerLevel.php');
-
 /**
  * The root logger.
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.9 $
+ * @version $Revision: 822448 $
  * @package log4php
  * @see Logger
  */
 class LoggerRoot extends Logger {
+	/**
+	 * Constructor
+	 *
+	 * @param integer $level initial log level
+	 */
+	public function __construct($level = null) {
+		parent::__construct('root');
 
-    /**
-     * @var string name of logger 
-     */
-    var $name   = 'root';
-
-    /**
-     * @var object must be null for LoggerRoot
-     */
-    var $parent = null;
-    
+		if($level == null) {
+			$level = LoggerLevel::getLevelAll();
+		}
+		$this->setLevel($level);
+	} 
+	
+	/**
+	 * @return LoggerLevel the level
+	 */
+	public function getChainedLevel() {
+		return parent::getLevel();
+	} 
+	
+	/**
+	 * Setting a null value to the level of the root category may have catastrophic results.
+	 * @param LoggerLevel $level
+	 */
+	public function setLevel($level) {
+		if($level != null) {
+			parent::setLevel($level);
+		}	 
+	}
+	
+	/**
+	 * Always returns false.
+	 * Because LoggerRoot has no parents, it returns false.
+	 * @param Logger $parent
+	 * @return boolean
+	 */
+	public function setParent(Logger $parent) {
+		return false;
+	}
 
-    /**
-     * Constructor
-     *
-     * @param integer $level initial log level
-     */
-    function LoggerRoot($level = null)
-    {
-        $this->Logger($this->name);
-        if ($level == null)
-            $level = LoggerLevel::getLevelAll();
-        $this->setLevel($level);
-    } 
-    
-    /**
-     * @return integer the level
-     */
-    function getChainedLevel()
-    {
-        return $this->level;
-    } 
-    
-    /**
-     * Setting a null value to the level of the root category may have catastrophic results.
-     * @param LoggerLevel $level
-     */
-    function setLevel($level)
-    {
-        $this->level = $level;
-    }    
- 
-    /**
-     * Please use setLevel() instead.
-     * @param LoggerLevel $level
-     * @deprecated
-     */
-    function setPriority($level)
-    {
-        $this->setLevel($level); 
-    }
-    
-    /**
-     * Always returns false.
-     * Because LoggerRoot has no parents, it returns false.
-     * @param Logger $parent
-     * @return boolean
-     */
-    function setParent($parent)
-    {
-        return false;
-    }  
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderAdodb.php b/libraries/log4php.debug/appenders/LoggerAppenderAdodb.php
new file mode 100644
index 000000000..4724939fe
--- /dev/null
+++ b/libraries/log4php.debug/appenders/LoggerAppenderAdodb.php
@@ -0,0 +1,263 @@
+<?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 c0508c7d0..7f1fe9128 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderConsole.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderConsole.php
@@ -1,139 +1,113 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
- */
-
-/**
- * @ignore 
  */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
-
-define('LOG4PHP_LOGGER_APPENDER_CONSOLE_STDOUT', 'php://stdout');
-define('LOG4PHP_LOGGER_APPENDER_CONSOLE_STDERR', 'php://stderr');
 
 /**
- * ConsoleAppender appends log events to STDOUT or STDERR using a layout specified by the user. 
+ * ConsoleAppender appends log events to STDOUT or STDERR. 
  * 
- * <p>Optional parameter is {@link $target}. The default target is Stdout.</p>
  * <p><b>Note</b>: Use this Appender with command-line php scripts. 
  * On web scripts this appender has no effects.</p>
- * <p>This appender requires a layout.</p>  
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.11 $
+ * Configurable parameters of this appender are:
+ *
+ * - layout     - The layout (required)
+ * - target     - "stdout" or "stderr"
+ * 
+ * An example php file:
+ * 
+ * {@example ../../examples/php/appender_console.php 19}
+ * 
+ * An example configuration file:
+ * 
+ * {@example ../../examples/resources/appender_console.properties 18}
+ * 
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */
-class LoggerAppenderConsole extends LoggerAppenderSkeleton {
-
-    /**
-     * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords <b>STDOUT</b> and <b>STDERR</b> (case insensitive). 
-     * Default is STDOUT
-     * @var string    
-     */
-    var $target = 'php://stdout';
-    
-    /**
-     * @var boolean
-     * @access private     
-     */
-    var $requiresLayout = true;
+class LoggerAppenderConsole extends LoggerAppender {
 
-    /**
-     * @var mixed the resource used to open stdout/stderr
-     * @access private     
-     */
-    var $fp = false;
-    
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderConsole($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
+	const STDOUT = 'php://stdout';
+	const STDERR = 'php://stderr';
 
-    /**
-     * Set console target.
-     * @param mixed $value a constant or a string
-     */
-    function setTarget($value)
-    {
-        $v = trim($value);
-        if ($v == LOG4PHP_LOGGER_APPENDER_CONSOLE_STDOUT or strtoupper($v) == 'STDOUT') {
-            $this->target = LOG4PHP_LOGGER_APPENDER_CONSOLE_STDOUT;
-        } elseif ($v == LOG4PHP_LOGGER_APPENDER_CONSOLE_STDOUT or strtoupper($v) == 'STDERR') {
-            $target = LOG4PHP_LOGGER_APPENDER_CONSOLE_STDOUT;
-        } else {
-            LoggerLog::debug(
-                "LoggerAppenderConsole::targetWarn() ".
-                "Invalid target. Using '".LOG4PHP_LOGGER_APPENDER_CONSOLE_STDOUT."' by default."
-            );        
-        }
-    }
+	/**
+	 * Can be 'php://stdout' or 'php://stderr'. But it's better to use keywords <b>STDOUT</b> and <b>STDERR</b> (case insensitive). 
+	 * Default is STDOUT
+	 * @var string	  
+	 */
+	private $target = self::STDOUT;
+	
+	/**
+	 * @var boolean
+	 * @access private	   
+	 */
+	protected $requiresLayout = true;
 
-    function getTarget()
-    {
-        return $this->target;
-    }
+	/**
+	 * @var mixed the resource used to open stdout/stderr
+	 * @access private	   
+	 */
+	protected $fp = null;
 
-    function activateOptions()
-    {
-        LoggerLog::debug("LoggerAppenderConsole::activateOptions()");
-            
-        $this->fp = @fopen($this->getTarget(), 'w');
-    
-        if ($this->fp and $this->layout !== null)
-            @fwrite($this->fp, $this->layout->getHeader());
+	public function __destruct() {
+       $this->close();
+   	}
+   	
+	/**
+	 * Set console target.
+	 * @param mixed $value a constant or a string
+	 */
+	public function setTarget($value) {
+		$v = trim($value);
+		if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
+			$this->target = self::STDOUT;
+		} elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
+			$this->target = self::STDERR;
+		} 
+	}
 
-        $this->closed = (bool)($this->fp === false);
-    }
-    
-    /**
-     * @see LoggerAppender::close()
-     */
-    function close()
-    {
-        LoggerLog::debug("LoggerAppenderConsole::close()");
-        
-        if ($this->fp and $this->layout !== null) {
-            @fwrite($this->fp, $this->layout->getFooter());
-        }        
-        @fclose($this->fp);
-        $this->closed = true;
-    }
+	public function activateOptions() {
+		$this->fp = fopen($this->target, 'w');
+		if(is_resource($this->fp) && $this->layout !== null) {
+			fwrite($this->fp, $this->layout->getHeader());
+		}
+		$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) {
+				fwrite($this->fp, $this->layout->getFooter());
+				fclose($this->fp);
+			}
+			$this->closed = true;
+		}			 
+	}
 
-    function append($event)
-    {
-        if ($this->fp and $this->layout !== null) {
-    
-            LoggerLog::debug("LoggerAppenderConsole::append()");
-        
-            @fwrite($this->fp, $this->layout->format($event));
-        } 
-    }
+	public function append(LoggerLoggingEvent $event) {
+		if (is_resource($this->fp) && $this->layout !== null) {
+			fwrite($this->fp, $this->layout->format($event));
+		} 
+	}
 }
 
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderDailyFile.php b/libraries/log4php.debug/appenders/LoggerAppenderDailyFile.php
index 3966bf6d3..d13404116 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderDailyFile.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderDailyFile.php
@@ -1,97 +1,98 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
-/**
- * @ignore 
- */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
  
 require_once(LOG4PHP_DIR . '/appenders/LoggerAppenderFile.php');
 
 /**
- * LoggerAppenderDailyFile appends log events to a file ne.
+ * An Appender that automatically creates a new logfile each day.
  *
- * A formatted version of the date pattern is used as to create the file name
- * using the {@link PHP_MANUAL#sprintf} function.
- * <p>Parameters are {@link $datePattern}, {@link $file}. Note that file 
- * parameter should include a '%s' identifier and should always be set 
- * before {@link $file} param.</p>
+ * The file is rolled over once a day. That means, for each day a new file 
+ * is created. A formatted version of the date pattern is used as to create 
+ * the file name using the {@link PHP_MANUAL#sprintf} function.
+ * 
+ * - layout             - Sets the layout class for this appender
+ * - datePattern        - Sets date format for the file name. Should be set before $file!
+ * - file               - The target file name. Should contain a '%s' which gets substituted by the date.
+ * - append             - Sets if the appender should append to the end of the file or overwrite content ("true" or "false")
+ * 
+ * An example php file:
+ * 
+ * {@example ../../examples/php/appender_dailyfile.php 19}
+ *  
+ * An example configuration file:
+ * 
+ * {@example ../../examples/resources/appender_dailyfile.properties 18}
+ *
+ * The above will create a file like: daily_20090908.log
  *
- * @author Abel Gonzalez <agonzalez@lpsz.org>
- * @version $Revision: 1.7 $
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
- */                      
+ */
 class LoggerAppenderDailyFile extends LoggerAppenderFile {
 
-    /**
-     * Format date. 
-     * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>.
-     * @var string
-     */
-    var $datePattern = "Ymd";
-    
-    /**
-    * Constructor
-    *
-    * @param string $name appender name
-    */
-    function LoggerAppenderDailyFile($name)
-    {
-        $this->LoggerAppenderFile($name); 
-    }
-    
-    /**
-    * Sets date format for the file name.
-    * @param string $format a regular date() string format
-    */
-    function setDatePattern ( $format )
-    {
-        $this->datePattern = $format;
-    }
-    
-    /**
-    * @return string returns date format for the filename
-    */
-    function getDatePattern ( )
-    {
-        return $this->datePattern;
-    }
-    
-    /**
-    * The File property takes a string value which should be the name of the file to append to.
-    * Sets and opens the file where the log output will go.
-    *
-    * @see LoggerAppenderFile::setFile()
-    */
-    function setFile()
-    {
-        $numargs = func_num_args();
-        $args    = func_get_args();
-        
-        if ($numargs == 1 and is_string($args[0])) {
-            parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())) );
-        } elseif ($numargs == 2 and is_string($args[0]) and is_bool($args[1])) {
-            parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())), $args[1] );
-        }
-    } 
+	/**
+	 * Format date. 
+	 * 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();
+   	}
+   	
+	/**
+	* Sets date format for the file name.
+	* @param string $format a regular date() string format
+	*/
+	public function setDatePattern($format) {
+		$this->datePattern = $format;
+	}
+	
+	/**
+	* @return string returns date format for the filename
+	*/
+	public function getDatePattern() {
+		return $this->datePattern;
+	}
+	
+	/**
+	* The File property takes a string value which should be the name of the file to append to.
+	* Sets and opens the file where the log output will go.
+	*
+	* @see LoggerAppenderFile::setFile()
+	*/
+	public function setFile() {
+		$numargs = func_num_args();
+		$args = func_get_args();
+		
+		if($numargs == 1 and is_string($args[0])) {
+			parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())) );
+		} else if ($numargs == 2 and is_string($args[0]) and is_bool($args[1])) {
+			parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())), $args[1] );
+		}
+	} 
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderDb.php b/libraries/log4php.debug/appenders/LoggerAppenderDb.php
deleted file mode 100644
index 021d5176f..000000000
--- a/libraries/log4php.debug/appenders/LoggerAppenderDb.php
+++ /dev/null
@@ -1,209 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage appenders
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
-require_once(LOG4PHP_DIR . '/helpers/LoggerOptionConverter.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-require_once('DB.php');
-
-/**
- * Appends log events to a db table using PEAR::DB class.
- *
- * <p>This appender uses a table in a database to log events.</p>
- * <p>Parameters are {@link $dsn}, {@link $createTable}, {@link table} and {@link $sql}.</p>
- * <p>See examples in test directory.</p>
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.7 $
- * @package log4php
- * @subpackage appenders
- * @since 0.3
- */
-class LoggerAppenderDb extends LoggerAppenderSkeleton {
-
-    /**
-     * Create the log table if it does not exists (optional).
-     * @var boolean
-     */
-    var $createTable = true;
-    
-    /**
-     * PEAR::Db Data source name. Read PEAR::Db for dsn syntax (mandatory).
-     * @var string
-     */
-    var $dsn;
-    
-    /**
-     * 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 PEAR::Db 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 LoggerAppenderDb($name)
-    {
-        $this->LoggerAppenderSkeleton($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 = DB::connect($this->dsn);
-
-        if (DB::isError($this->db)) {
-            LoggerLog::debug("LoggerAppenderDb::activateOptions() DB Connect Error [".$this->db->getMessage()."]");            
-            $this->db = null;
-            $this->closed = true;
-            $this->canAppend = false;
-
-        } else {
-        
-            $this->layout = LoggerLayout::factory('LoggerPatternLayout');
-            $this->layout->setConversionPattern($this->getSql());
-        
-            // test if log table exists
-            $tableInfo = $this->db->tableInfo($this->table, $mode = null);
-            if (DB::isError($tableInfo) 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) );";
-
-                LoggerLog::debug("LoggerAppenderDb::activateOptions() creating table '{$this->table}'... using sql='$query'");
-                         
-                $result = $this->db->query($query);
-                if (DB::isError($result)) {
-                    LoggerLog::debug("LoggerAppenderDb::activateOptions() error while creating '{$this->table}'. Error is ".$result->getMessage());
-                    $this->canAppend = false;
-                    return;
-                }
-            }
-            $this->canAppend = true;            
-        }
-
-    }
-    
-    function append($event)
-    {
-        if ($this->canAppend) {
-
-            $query = $this->layout->format($event);
-
-            LoggerLog::debug("LoggerAppenderDb::append() query='$query'");
-
-            $this->db->query($query);
-        }
-    }
-    
-    function close()
-    {
-        if ($this->db !== null)
-            $this->db->disconnect();
-        $this->closed = true;
-    }
-    
-    /**
-     * @return boolean
-     */
-    function getCreateTable()
-    {
-        return $this->createTable;
-    }
-    
-    /**
-     * @return string the defined dsn
-     */
-    function getDsn()
-    {
-        return $this->dsn;
-    }
-    
-    /**
-     * @return string the sql pattern string
-     */
-    function getSql()
-    {
-        return $this->sql;
-    }
-    
-    /**
-     * @return string the table name to create
-     */
-    function getTable()
-    {
-        return $this->table;
-    }
-    
-    function setCreateTable($flag)
-    {
-        $this->createTable = LoggerOptionConverter::toBoolean($flag, true);
-    }
-    
-    function setDsn($newDsn)
-    {
-        $this->dsn = $newDsn;
-    }
-    
-    function setSql($sql)
-    {
-        $this->sql = $sql;    
-    }
-    
-    function setTable($table)
-    {
-        $this->table = $table;
-    }
-    
-}
-
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderEcho.php b/libraries/log4php.debug/appenders/LoggerAppenderEcho.php
index a615dfc3f..294478443 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderEcho.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderEcho.php
@@ -1,20 +1,21 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
 /**
@@ -24,66 +25,65 @@ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
  
 /**
  */
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
 
 /**
  * LoggerAppenderEcho uses {@link PHP_MANUAL#echo echo} function to output events. 
  * 
- * <p>This appender requires a layout.</p>  
+ * <p>This appender requires a layout.</p>	
+ * 
+ * An example php file:
+ * 
+ * {@example ../../examples/php/appender_echo.php 19}
+ * 
+ * An example configuration file:
+ * 
+ * {@example ../../examples/resources/appender_echo.properties 18}
+ * 
+ * The above example would print the following:
+ * <pre>
+ *    Tue Sep  8 22:44:55 2009,812 [6783] DEBUG appender_echo - Hello World!
+ * </pre>
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.5 $
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */
-class LoggerAppenderEcho extends LoggerAppenderSkeleton {
-
-    /**
-     * @access private 
-     */
-    var $requiresLayout = true;
-
-    /**
-     * @var boolean used internally to mark first append 
-     * @access private 
-     */
-    var $firstAppend    = true;
-    
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderEcho($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
-
-    function activateOptions()
-    {
-        return;
-    }
-    
-    function close()
-    {
-        if (!$this->firstAppend)
-            echo $this->layout->getFooter();
-        $this->closed = true;    
-    }
+class LoggerAppenderEcho extends LoggerAppender {
+	/** boolean used internally to mark first append */
+	private $firstAppend = true;
+	
+	public function __construct($name = '') {
+	    parent::__construct($name);
+	    $this->requiresLayout = true;
+	    $this->firstAppend = true;
+	}
+	
+	public function __destruct() {
+       $this->close();
+   	}
+   	
+	public function activateOptions() {
+		$this->closed = false;
+	}
+	
+	public function close() {
+		if($this->closed != true) {
+			if(!$this->firstAppend) {
+				echo $this->layout->getFooter();
+			}
+		}
+		$this->closed = true;	 
+	}
 
-    function append($event)
-    {
-        LoggerLog::debug("LoggerAppenderEcho::append()");
-        
-        if ($this->layout !== null) {
-            if ($this->firstAppend) {
-                echo $this->layout->getHeader();
-                $this->firstAppend = false;
-            }
-            echo $this->layout->format($event);
-        } 
-    }
+	public function append(LoggerLoggingEvent $event) {
+		if($this->layout !== null) {
+			if($this->firstAppend) {
+				echo $this->layout->getHeader();
+				$this->firstAppend = false;
+			}
+			echo $this->layout->format($event);
+		} 
+	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderFile.php b/libraries/log4php.debug/appenders/LoggerAppenderFile.php
index 8fa312ade..f5d4ca518 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderFile.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderFile.php
@@ -1,20 +1,21 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
 /**
@@ -22,163 +23,156 @@
  */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
 
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
 require_once(LOG4PHP_DIR . '/helpers/LoggerOptionConverter.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
 
 /**
  * FileAppender appends log events to a file.
  *
- * Parameters are ({@link $fileName} but option name is <b>file</b>), 
- * {@link $append}.
+ * Configurable parameters for this appender are:
+ * 
+ * - layout             - Sets the layout class for this appender
+ * - file               - The target file to write to
+ * - filename           - The target file to write to
+ * - append             - Sets if the appender should append to the end of the file or overwrite content ("true" or "false")
+ *
+ * An example php file:
+ * 
+ * {@example ../../examples/php/appender_file.php 19}
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.15 $
+ * An example configuration file:
+ * 
+ * {@example ../../examples/resources/appender_file.properties 18}
+ * 
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */
-class LoggerAppenderFile extends LoggerAppenderSkeleton {
-
-    /**
-     * @var boolean if {@link $file} exists, appends events.
-     */
-    var $append = true;  
-
-    /**
-     * @var string the file name used to append events
-     */
-    var $fileName;
-
-    /**
-     * @var mixed file resource
-     * @access private
-     */
-    var $fp = false;
-    
-    /**
-     * @access private
-     */
-    var $requiresLayout = true;
-    
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderFile($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
-
-    function activateOptions()
-    {
-        $fileName = $this->getFile();
-        LoggerLog::debug("LoggerAppenderFile::activateOptions() opening file '{$fileName}'");
-        $this->fp = @fopen($fileName, ($this->getAppend()? 'a':'w'));
+class LoggerAppenderFile extends LoggerAppender {
 
-	// Denying read option for log file. Added for Vulnerability fix
-	if (is_readable($fileName)) chmod ($fileName,0222);
+	/**
+	 * @var boolean if {@link $file} exists, appends events.
+	 */
+	private $append = true;
+	/**
+	 * @var string the file name used to append events
+	 */
+	protected $fileName;
+	/**
+	 * @var mixed file resource
+	 */
+	protected $fp = false;
+	
+	public function __construct($name = '') {
+		parent::__construct($name);
+		$this->requiresLayout = true;
+	}
 
-        if ($this->fp) {
-            if ($this->getAppend())
-                fseek($this->fp, 0, SEEK_END);
-            @fwrite($this->fp, $this->layout->getHeader());
-            $this->closed = false;
-        } else {
-            $this->closed = true;
-        }
-    }
-    
-    function close()
-    {
-        if ($this->fp and $this->layout !== null)
-            @fwrite($this->fp, $this->layout->getFooter());
-            
-        $this->closeFile();
-        $this->closed = true;
-    }
+	public function __destruct() {
+       $this->close();
+   	}
+   	
+	public function activateOptions() {
+		$fileName = $this->getFile();
 
-    /**
-     * Closes the previously opened file.
-     */
-    function closeFile() 
-    {
-        if ($this->fp)
-            @fclose($this->fp);
-    }
-    
-    /**
-     * @return boolean
-     */
-    function getAppend()
-    {
-        return $this->append;
-    }
+		if(!is_file($fileName)) {
+			$dir = dirname($fileName);
+			if(!is_dir($dir)) {
+				mkdir($dir, 0777, true);
+			}
+		}
 
-    /**
-     * @return string
-     */
-    function getFile()
-    {
-        return $this->getFileName();
-    }
-    
-    /**
-     * @return string
-     */
-    function getFileName()
-    {
-        return $this->fileName;
-    } 
- 
-    /**
-     * Close any previously opened file and call the parent's reset.
-     */
-    function reset()
-    {
-        $this->closeFile();
-        $this->fileName = null;
-        parent::reset();
-    }
+		$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;
+		}
+	}
+	
+	public function close() {
+		if($this->closed != true) {
+			if($this->fp and $this->layout !== null) {
+				if(flock($this->fp, LOCK_EX)) {
+					fwrite($this->fp, $this->layout->getFooter());
+					flock($this->fp, LOCK_UN);
+				}
+				fclose($this->fp);
+			}
+			$this->closed = true;
+		}
+	}
 
-    function setAppend($flag)
-    {
-        $this->append = LoggerOptionConverter::toBoolean($flag, true);        
-    } 
-  
-    /**
-     * Sets and opens the file where the log output will go.
-     *
-     * This is an overloaded method. It can be called with:
-     * - setFile(string $fileName) to set filename.
-     * - setFile(string $fileName, boolean $append) to set filename and append.
-     */
-    function setFile()
-    {
-        $numargs = func_num_args();
-        $args    = func_get_args();
+	public function append(LoggerLoggingEvent $event) {
+		if($this->fp and $this->layout !== null) {
+			if(flock($this->fp, LOCK_EX)) {
+				fwrite($this->fp, $this->layout->format($event));
+				flock($this->fp, LOCK_UN);
+			} else {
+				$this->closed = true;
+			}
+		} 
+	}
+	
+	/**
+	 * Sets and opens the file where the log output will go.
+	 *
+	 * This is an overloaded method. It can be called with:
+	 * - setFile(string $fileName) to set filename.
+	 * - setFile(string $fileName, boolean $append) to set filename and append.
+	 * 
+	 * TODO: remove overloading. Use only file as alias to filename
+	 */
+	public function setFile() {
+		$numargs = func_num_args();
+		$args	 = func_get_args();
 
-        if ($numargs == 1 and is_string($args[0])) {
-            $this->setFileName($args[0]);
-        } elseif ($numargs >=2 and is_string($args[0]) and is_bool($args[1])) {
-            $this->setFile($args[0]);
-            $this->setAppend($args[1]);
-        }
-    }
-    
-    function setFileName($fileName)
-    {
-        $this->fileName = $fileName;
-    }
+		if($numargs == 1 and is_string($args[0])) {
+			$this->setFileName($args[0]);
+		} else if ($numargs >=2 and is_string($args[0]) and is_bool($args[1])) {
+			$this->setFile($args[0]);
+			$this->setAppend($args[1]);
+		}
+	}
+	
+	/**
+	 * @return string
+	 */
+	public function getFile() {
+		return $this->getFileName();
+	}
+	
+	/**
+	 * @return boolean
+	 */
+	public function getAppend() {
+		return $this->append;
+	}
 
-    function append($event)
-    {
-        if ($this->fp and $this->layout !== null) {
+	public function setAppend($flag) {
+		$this->append = LoggerOptionConverter::toBoolean($flag, true);		  
+	}
 
-            LoggerLog::debug("LoggerAppenderFile::append()");
-        
-            @fwrite($this->fp, $this->layout->format($event));
-        } 
-    }
+	public function setFileName($fileName) {
+		$this->fileName = $fileName;
+	}
+	
+	/**
+	 * @return string
+	 */
+	public function getFileName() {
+		return $this->fileName;
+	}
+	
+	 
 }
 ?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderMail.php b/libraries/log4php.debug/appenders/LoggerAppenderMail.php
index c211e4a04..384b0f170 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderMail.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderMail.php
@@ -1,20 +1,21 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
 /**
@@ -22,127 +23,115 @@
  */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
  
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
 /**
  * Appends log events to mail using php function {@link PHP_MANUAL#mail}.
  *
- * <p>Parameters are {@link $from}, {@link $to}, {@link $subject}.</p>
- * <p>This appender requires a layout.</p>
+ * The appender sends all log events at once after the request has been
+ * finsished and the appender is beeing closed.
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.8 $
+ * Configurable parameters for this appender:
+ * 
+ * - layout             - Sets the layout class for this appender (required)
+ * - to                 - Sets the recipient of the mail (required)
+ * - from               - Sets the sender of the mail (optional)
+ * - subject            - Sets the subject of the mail (optional)
+ * 
+ * An example:
+ * 
+ * {@example ../../examples/php/appender_mail.php 19}
+ * 
+ * {@example ../../examples/resources/appender_mail.properties 18}
+ * 
+ * The above will output something like:
+ * <pre>
+ *      Date: Tue,  8 Sep 2009 21:51:04 +0200 (CEST)
+ *      From: someone@example.com
+ *      To: root@localhost
+ *      Subject: Log4php test
+ *      
+ *      Tue Sep  8 21:51:04 2009,120 [5485] FATAL root - Some critical message!
+ *      Tue Sep  8 21:51:06 2009,120 [5485] FATAL root - Some more critical message!
+ * </pre>
+
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */
-class LoggerAppenderMail extends LoggerAppenderSkeleton {
-
-    /**
-     * @var string 'from' field
-     */
-    var $from = null;
-
-    /**
-     * @var string 'subject' field
-     */
-    var $subject = 'Log4php Report';
-    
-    /**
-     * @var string 'to' field
-     */
-    var $to = null;
+class LoggerAppenderMail extends LoggerAppender {
 
-    /**
-     * @var string used to create mail body
-     * @access private
-     */
-    var $body = '';
-    
-    /**
-     * @access private
-     */
-    var $requiresLayout = true;
-    
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderMail($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
+	/** @var string 'from' field */
+	private $from = null;
 
-    function activateOptions()
-    {
-        $this->closed = false;
-        return;
-    }
-    
-    function close()
-    {
-        $from       = $this->getFrom();
-        $to         = $this->getTo();
+	/** @var string 'subject' field */
+	private $subject = 'Log4php Report';
+	
+	/** @var string 'to' field */
+	private $to = null;
 
-        if (!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) {
+	/** @var indiciates if this appender should run in dry mode */
+	private $dry = false;
 
-            $subject    = $this->getSubject();            
+	/** @var string used to create mail body */
+	private $body = '';
+	
+	/**
+	 * Constructor.
+	 *
+	 * @param string $name appender name
+	 */
+	public function __construct($name = '') {
+		parent::__construct($name);
+		$this->requiresLayout = true;
+	}
 
-            LoggerLog::debug("LoggerAppenderMail::close() sending mail from=[{$from}] to=[{$to}] subject=[{$subject}]");
-            
-            @mail(
-                $to, $subject, 
-                $this->layout->getHeader() . $this->body . $this->layout->getFooter(),
-                "From: {$from}\r\n"
-            );
-        }
-        $this->closed = true;
-    }
-    
-    /**
-     * @return string
-     */
-    function getFrom()
-    {
-        return $this->from;
-    }
-    
-    /**
-     * @return string
-     */
-    function getSubject()
-    {
-        return $this->subject;
-    }
+	public function __destruct() {
+       $this->close();
+   	}
 
-    /**
-     * @return string
-     */
-    function getTo()
-    {
-        return $this->to;
-    }
-    
-    function setSubject($subject)
-    {
-        $this->subject = $subject;
-    }
-    
-    function setTo($to)
-    {
-        $this->to = $to;
-    }
+	public function activateOptions() {
+		$this->closed = false;
+	}
+	
+	public function close() {
+		if($this->closed != true) {
+			$from = $this->from;
+			$to = $this->to;
+	
+			if(!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) {
+				$subject = $this->subject;
+				if(!$this->dry) {
+					mail(
+						$to, $subject, 
+						$this->layout->getHeader() . $this->body . $this->layout->getFooter(),
+						"From: {$from}\r\n");
+				} else {
+				    echo "DRY MODE OF MAIL APP.: Send mail to: ".$to." with content: ".$this->body;
+				}
+			}
+			$this->closed = true;
+		}
+	}
+	
+	public function setSubject($subject) {
+		$this->subject = $subject;
+	}
+	
+	public function setTo($to) {
+		$this->to = $to;
+	}
 
-    function setFrom($from)
-    {
-        $this->from = $from;
-    }  
+	public function setFrom($from) {
+		$this->from = $from;
+	}  
 
-    function append($event)
-    {
-        if ($this->layout !== null)
-            $this->body .= $this->layout->format($event);
-    }
+	public function setDry($dry) {
+		$this->dry = $dry;
+	}
+	
+	public function append(LoggerLoggingEvent $event) {
+		if($this->layout !== null) {
+			$this->body .= $this->layout->format($event);
+		}
+	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderMailEvent.php b/libraries/log4php.debug/appenders/LoggerAppenderMailEvent.php
index 1152255d1..adf714979 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderMailEvent.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderMailEvent.php
@@ -1,170 +1,182 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
-/**
- * @ignore 
- */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
 
 /**
- */
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
-/**
- * Log events to an email address. It will be created an email for each event. 
+ * Log every events as a separate email.
+ * 
+ * Configurable parameters for this appender are:
+ * 
+ * - layout             - Sets the layout class for this appender (required)
+ * - to                 - Sets the recipient of the mail (required)
+ * - from               - Sets the sender of the mail (optional)
+ * - subject            - Sets the subject of the mail (optional)
+ * - smtpHost           - Sets the mail server (optional, default is ini_get('SMTP'))
+ * - port               - Sets the port of the mail server (optional, default is 25)
+ *
+ * An example:
+ * 
+ * {@example ../../examples/php/appender_mailevent.php 19}
+ *  
+ * {@example ../../examples/resources/appender_mailevent.properties 18}
+ *
+ * 
+ * The above will output something like:
+ * <pre>
+ *      Date: Tue,  8 Sep 2009 21:51:04 +0200 (CEST)
+ *      From: someone@example.com
+ *      To: root@localhost
+ *      Subject: Log4php test
  *
- * <p>Parameters are 
- * {@link $smtpHost} (optional), 
- * {@link $port} (optional), 
- * {@link $from} (optional), 
- * {@link $to}, 
- * {@link $subject} (optional).</p>
- * <p>A layout is required.</p>
+ *      Tue Sep  8 21:51:04 2009,120 [5485] FATAL root - Some critical message!
+ * </pre>
  *
- * @author Domenico Lordi <lordi@interfree.it>
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.10 $
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */
-class LoggerAppenderMailEvent extends LoggerAppenderSkeleton {
-
-    /**
-     * @var string 'from' field
-     */
-    var $from           = null;
-
-    /**
-     * @var integer 'from' field
-     */
-    var $port           = 25;
-
-    /**
-     * @var string hostname. 
-     */
-    var $smtpHost       = null;
-
-    /**
-     * @var string 'subject' field
-     */
-    var $subject        = '';
-
-    /**
-     * @var string 'to' field
-     */
-    var $to             = null;
-    
-    /**
-     * @access private
-     */
-    var $requiresLayout = true;
-
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderMailEvent($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
-
-    function activateOptions()
-    { 
-        $this->closed = false;
-    }
-    
-    function close()
-    {
-        $this->closed = true;
-    }
-
-    /**
-     * @return string
-     */
-    function getFrom()      { return $this->from; }
-    
-    /**
-     * @return integer
-     */
-    function getPort()      { return $this->port; }
-    
-    /**
-     * @return string
-     */
-    function getSmtpHost()  { return $this->smtpHost; }
-    
-    /**
-     * @return string
-     */
-    function getSubject()   { return $this->subject; }
-
-    /**
-     * @return string
-     */
-    function getTo()        { return $this->to; }
-
-    function setFrom($from)             { $this->from = $from; }
-    function setPort($port)             { $this->port = (int)$port; }
-    function setSmtpHost($smtphost)     { $this->smtpHost = $smtpHost; }
-    function setSubject($subject)       { $this->subject = $subject; }
-    function setTo($to)                 { $this->to = $to; }
-
-    function append($event)
-    {
-        $from = $this->getFrom();
-        $to   = $this->getTo();
-        if (empty($from) or empty($to))
-            return;
-    
-        $smtpHost = $this->getSmtpHost();
-        $prevSmtpHost = ini_get('SMTP');
-        if (!empty($smtpHost)) {
-            ini_set('SMTP', $smtpHost);
-        } else {
-            $smtpHost = $prevSmtpHost;
-        } 
-
-        $smtpPort = $this->getPort();
-        $prevSmtpPort= ini_get('smtp_port');        
-        if ($smtpPort > 0 and $smtpPort < 65535) {
-            ini_set('smtp_port', $smtpPort);
-        } else {
-            $smtpPort = $prevSmtpPort;
-        } 
-        
-        LoggerLog::debug(
-            "LoggerAppenderMailEvent::append()" . 
-            ":from=[{$from}]:to=[{$to}]:smtpHost=[{$smtpHost}]:smtpPort=[{$smtpPort}]"
-        ); 
+class LoggerAppenderMailEvent extends LoggerAppender {
+
+	/**  'from' field (defaults to 'sendmail_from' from php.ini on win32).
+	 * @var string
+	 */
+	private $from = null;
+
+	/** Mailserver port (win32 only).
+	 * @var integer 
+	 */
+	private $port = 25;
+
+	/** Mailserver hostname (win32 only).
+	 * @var string   
+	 */
+	private $smtpHost = null;
+
+	/**
+	 * @var string 'subject' field
+	 */
+	private $subject = '';
+
+	/**
+	 * @var string 'to' field
+	 */
+	private $to = null;
+	
+	/**
+	 * @access private
+	 */
+	protected $requiresLayout = true;
+
+	/** @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();
+   	}
+   	
+	public function activateOptions() {
+	    if (empty($this->layout)) {
+	        throw new LoggerException("LoggerAppenderMailEvent requires layout!");
+	    }
+	    if (empty($this->to)) {
+            throw new LoggerException("LoggerAppenderMailEvent was initialized with empty 'from' ($this->from) or 'to' ($this->to) Adress!");
+        }
         
-        if (!@mail( $to, $this->getSubject(), 
-            $this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), 
-            "From: {$from}\r\n"
-        )) {
-            LoggerLog::debug("LoggerAppenderMailEvent::append() mail error");
+        $sendmail_from = ini_get('sendmail_from');
+        if (empty($this->from) and empty($sendmail_from)) {
+            throw new LoggerException("LoggerAppenderMailEvent requires 'from' or on win32 at least the ini variable sendmail_from!");
         }
-            
-        ini_set('SMTP',         $prevSmtpHost);
-        ini_set('smtp_port',    $prevSmtpPort);
-    }
+        
+        $this->closed = false;
+	}
+	
+	public function close() {
+		$this->closed = true;
+	}
+
+	public function setFrom($from) {
+		$this->from = $from;
+	}
+	
+	public function setPort($port) {
+		$this->port = (int)$port;
+	}
+	
+	public function setSmtpHost($smtpHost) {
+		$this->smtpHost = $smtpHost;
+	}
+	
+	public function setSubject($subject) {
+		$this->subject = $subject;
+	}
+	
+	public function setTo($to) {
+		$this->to = $to;
+	}
+
+	public function setDry($dry) {
+		$this->dry = $dry;
+	}
+	
+	public function append(LoggerLoggingEvent $event) {
+		$smtpHost = $this->smtpHost;
+		$prevSmtpHost = ini_get('SMTP');
+		if(!empty($smtpHost)) {
+			ini_set('SMTP', $smtpHost);
+		} 
+
+		$smtpPort = $this->port;
+		$prevSmtpPort= ini_get('smtp_port');		
+		if($smtpPort > 0 and $smtpPort < 65535) {
+			ini_set('smtp_port', $smtpPort);
+		}
+
+		// On unix only sendmail_path, which is PHP_INI_SYSTEM i.e. not changeable here, is used.
+
+		$addHeader = empty($this->from) ? '' : "From: {$this->from}\r\n";
+		
+		if(!$this->dry) {
+			$result = mail($this->to, $this->subject, 
+				$this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), 
+				$addHeader);			
+		    if ($result === false) {
+		        // The error message is only printed to stderr as warning. Any idea how to get it?
+		        throw new LoggerException("Error sending mail to '".$this->to."'!");
+		    }
+		} else {
+		    echo "DRY MODE OF MAIL APP.: Send mail to: ".$this->to." with additional headers '".trim($addHeader)."' and content: ".$this->layout->format($event);
+		}
+			
+		ini_set('SMTP', $prevSmtpHost);
+		ini_set('smtp_port', $prevSmtpPort);
+	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderNull.php b/libraries/log4php.debug/appenders/LoggerAppenderNull.php
index 36a2f54a2..61480286a 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderNull.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderNull.php
@@ -1,72 +1,66 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
 /**
  * @ignore 
  */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
 
 /**
- * A NullAppender merely exists, it never outputs a message to any device.  
+ * A NullAppender merely exists, it never outputs a message to any device.	
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.4 $
+ * This appender has no configurable parameters.
+ * 
+ * An example:
+ * 
+ * {@example ../../examples/php/appender_null.php 19}
+ * 
+ * {@example ../../examples/resources/appender_null.properties 18}
+ * 
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */
-class LoggerAppenderNull extends LoggerAppenderSkeleton {
-
-    /**
-     * @access private
-     */
-    var $requiresLayout = false;
-    
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderNull($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
+class LoggerAppenderNull extends LoggerAppender {
 
-    function activateOptions()
-    { 
-        $this->closed = false;
-    }
-    
-    function close()
-    {
-        $this->closed = true;
-    }
-    
-    /**
-     * Do nothing. How I Love it !! :)
-     */
-    function append($event)
-    {
-        LoggerLog::debug("LoggerAppenderNull::append()");
-    }
+	protected $requiresLayout = false;
+	
+	public function __destruct() {
+       $this->close();
+   	}
+   	
+	public function activateOptions() {
+		$this->closed = false;
+	}
+	
+	public function close() {
+		$this->closed = true;
+	}
+	
+	/**
+	 * Do nothing. 
+	 * 
+	 * @param LoggerLoggingEvent $event
+	 */
+	public function append(LoggerLoggingEvent $event) {
+	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderPDO.php b/libraries/log4php.debug/appenders/LoggerAppenderPDO.php
new file mode 100644
index 000000000..8fadd003a
--- /dev/null
+++ b/libraries/log4php.debug/appenders/LoggerAppenderPDO.php
@@ -0,0 +1,296 @@
+<?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
+ */
+
+/**
+ * Appends log events to a db table using PDO.
+ *
+ * Configurable parameters of this appender are:
+ *
+ * - user            - Sets the user of this database connection
+ * - password        - Sets the password of this database connection
+ * - createTable     - true, if the table should be created if necessary. false otherwise
+ * - table           - Sets the table name (default: log4php_log)
+ * - sql             - Sets the insert statement for a logging event. Defaults
+ *                     to the correct one - change only if you are sure what you are doing.
+ * - dsn             - Sets the DSN string for this connection
+ *
+ * If $sql is set then $table and $sql are used, else $table, $insertSql and $insertPattern.
+ *
+ * An example:
+ *
+ * {@example ../../examples/php/appender_pdo.php 19}
+ * 
+ * {@example ../../examples/resources/appender_pdo.properties 18}
+ * 
+ * @version $Revision: 806678 $
+ * @package log4php
+ * @subpackage appenders
+ * @since 2.0
+ */
+class LoggerAppenderPDO extends LoggerAppender {
+
+    /** Create the log table if it does not exists (optional).
+     * @var string */
+	private $createTable = true;
+    
+    /** Database user name.
+     * @var string */
+    private $user = '';
+    
+    /** Database password
+     * @var string */
+    private $password = '';
+    
+    /** DSN string for enabling a connection.
+     * @var string */
+    private $dsn;
+    
+    /** A {@link LoggerPatternLayout} string used to format a valid insert query.
+     * @deprecated Use {@link $insertSql} and {@link $insertPattern} which properly handle quotes in the messages!
+     * @var string */
+    private $sql;
+    
+    /** Can be set to a complete insert statement with ? that are replaced using {@link insertPattern}.
+     * @var string */
+    private $insertSql = "INSERT INTO __TABLE__ (timestamp, logger, level, message, thread, file, line) VALUES (?,?,?,?,?,?,?)";
+
+    /** A comma separated list of {@link LoggerPatternLayout} format strings that replace the "?" in {@link $sql}.
+     * @var string */
+    private $insertPattern = "%d,%c,%p,%m,%t,%F,%L";
+
+    /** Table name to write events. Used only for CREATE TABLE if {@link $createTable} is true.
+     * @var string */
+    private $table = 'log4php_log';
+    
+    /** The PDO instance.
+     * @var PDO */
+    private $db = null;
+    
+    /** Prepared statement for the INSERT INTO query.
+     * @var PDOStatement */
+    private $preparedInsert;
+
+    /** Set in activateOptions() and later used in append() to check if all conditions to append are true.
+     * @var boolean */
+    private $canAppend = true;
+    
+    /**
+     * Constructor.
+     * This apender doesn't require a layout.
+     * @param string $name appender name
+     */
+    public function __construct($name = '') {
+        parent::__construct($name);
+        $this->requiresLayout = false;
+    }
+    
+	public function __destruct() {
+       $this->close();
+   	}
+   	
+    /**
+     * Setup db connection.
+     * Based on defined options, this method connects to db defined in {@link $dsn}
+     * and creates a {@link $table} table if {@link $createTable} is true.
+     * @return boolean true if all ok.
+     * @throws a PDOException if the attempt to connect to the requested database fails.
+     */
+    public function activateOptions() {
+        try {
+        	if($this->user === null) {
+	           	$this->db = new PDO($this->dsn);
+    	   } else if($this->password === null) {
+    	       $this->db = new PDO($this->dsn, $this->user);
+    	   } else {
+    	       $this->db = new PDO($this->dsn,$this->user,$this->password);
+    	   }
+    	   $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+    	
+            // test if log table exists
+            try {
+                $result = $this->db->query('SELECT * FROM ' . $this->table . ' WHERE 1 = 0');
+            } catch (PDOException $e) {
+                // It could be something else but a "no such table" is the most likely
+                $result = false;
+            }
+            
+            // create table if necessary
+            if ($result == false and $this->createTable) {
+                // The syntax should at least be compatible with MySQL, PostgreSQL, SQLite and Oracle.
+                $query = "CREATE TABLE {$this->table} (".
+                            "timestamp varchar(32)," .
+            				"logger varchar(64)," .
+            										"level varchar(32)," .
+            				"message varchar(9999)," .
+            										"thread varchar(32)," .
+            				"file varchar(255)," .
+            				"line varchar(6))";
+                $result = $this->db->query($query);
+            }
+        } catch (PDOException $e) {
+            $this->canAppend = false;
+            throw new LoggerException($e);
+        }
+        
+        $this->layout = new LoggerLayoutPattern();
+        
+        //
+        // Keep compatibility to legacy option $sql which already included the format patterns!
+        //
+        if (empty($this->sql)) {
+            // new style with prepared Statment and $insertSql and $insertPattern
+            // Maybe the tablename has to be substituted.
+            $this->insertSql = preg_replace('/__TABLE__/', $this->table, $this->insertSql);
+            $this->preparedInsert = $this->db->prepare($this->insertSql);
+            $this->layout->setConversionPattern($this->insertPattern);
+        } else {
+            // Old style with format strings in the $sql query should be used.
+        $this->layout->setConversionPattern($this->sql);
+        }
+
+        $this->canAppend = true;
+        return true;
+    }
+    
+    /**
+     * Appends a new event to the database.
+     * 
+     * @throws LoggerException      If the pattern conversion or the INSERT statement fails.
+     */
+    public function append(LoggerLoggingEvent $event) {
+        // TODO: Can't activateOptions() simply throw an Exception if it encounters problems?
+        if ( ! $this->canAppend) return;
+
+            try {
+            if (empty($this->sql)) {
+                // new style with prepared statement
+                $params = $this->layout->formatToArray($event);
+                $this->preparedInsert->execute($params);
+            } else {
+                // old style
+                $query = $this->layout->format($event);
+                $this->db->exec($query);
+            }
+            } catch (Exception $e) {
+                throw new LoggerException($e);
+            }
+        }
+    
+    /**
+     * Closes the connection to the logging database
+     */
+    public function close() {
+    	if($this->closed != true) {
+        	if ($this->db !== null) {
+            	$db = null;
+        	}
+        	$this->closed = true;
+    	}
+    }
+    
+    /**
+     * Sets the username for this connection. 
+     * Defaults to ''
+     */
+    public function setUser($user) {
+        $this->user = $user;
+    }
+    
+    /**
+     * Sets the password for this connection. 
+     * Defaults to ''
+     */
+    public function setPassword($password) {
+        $this->password = $password;
+    }
+    
+    /**
+     * Indicator if the logging table should be created on startup,
+     * if its not existing.
+     */
+    public function setCreateTable($flag) {
+        $this->createTable = LoggerOptionConverter::toBoolean($flag, true);
+    }
+   
+   	/**
+     * Sets the SQL string into which the event should be transformed.
+     * Defaults to:
+     * 
+     * INSERT INTO $this->table 
+     * ( timestamp, logger, level, message, thread, file, line) 
+     * VALUES 
+     * ('%d','%c','%p','%m','%t','%F','%L')
+     * 
+     * It's not necessary to change this except you have customized logging'
+     *
+     * @deprecated See {@link setInsertSql} and {@link setInsertPattern}.
+     */
+    public function setSql($sql) {
+        $this->sql = $sql;    
+    }
+    
+    /**
+     * Sets the SQL INSERT string to use with {@link $insertPattern}.
+     *
+     * @param $sql          A complete INSERT INTO query with "?" that gets replaced.
+     */
+    public function setInsertSql($sql) {
+        $this->insertSql = $sql;
+    }
+
+    /**
+     * Sets the {@link LoggerLayoutPattern} format strings for {@link $insertSql}.
+     *
+     * It's not necessary to change this except you have customized logging.
+     *
+     * @param $pattern          Comma separated format strings like "%p,%m,%C"
+     */
+    public function setInsertPattern($pattern) {
+        $this->insertPattern = $pattern;
+    }
+
+    /**
+     * Sets the tablename to which this appender should log.
+     * Defaults to log4php_log
+     */
+    public function setTable($table) {
+        $this->table = $table;
+    }
+    
+    /**
+     * Sets the DSN string for this connection. In case of
+     * SQLite it could look like this: 'sqlite:appenders/pdotest.sqlite'
+     */
+    public function setDSN($dsn) {
+        $this->dsn = $dsn;
+    }
+    
+    /**
+     * Sometimes databases allow only one connection to themselves in one thread.
+     * SQLite has this behaviour. In that case this handle is needed if the database
+     * must be checked for events.
+     *
+     * @return PDO
+     */
+    public function getDatabaseHandle() {
+        return $this->db;
+    }
+}
+
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderPhp.php b/libraries/log4php.debug/appenders/LoggerAppenderPhp.php
index 69db3457e..eee2113ae 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderPhp.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderPhp.php
@@ -1,85 +1,80 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
 /**
  * @ignore 
  */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
+
 require_once(LOG4PHP_DIR . '/LoggerLevel.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
 
 /**
  * Log events using php {@link PHP_MANUAL#trigger_error} function and a {@link LoggerLayoutTTCC} default layout.
  *
+ * 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  
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.11 $
+ * An example:
+ * 
+ * {@example ../../examples/php/appender_php.php 19}
+ * 
+ * {@example ../../examples/resources/appender_php.properties 18}
+ *
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */ 
-class LoggerAppenderPhp extends LoggerAppenderSkeleton {
-
-    /**
-     * @access private
-     */
-    var $requiresLayout = false;
-    
-    /**
-     * Constructor
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderPhp($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
+class LoggerAppenderPhp extends LoggerAppender {
 
-    function activateOptions()
-    {
-        $this->layout = LoggerLayout::factory('LoggerLayoutTTCC');
-        $this->closed = false;
-    }
+	public function __construct($name = '') {
+		parent::__construct($name);
+		$this->requiresLayout = true;
+	}
+	
+	public function __destruct() {
+       $this->close();
+   	}
+	
+	public function activateOptions() {
+		$this->closed = false;
+	}
 
-    function close() 
-    {
-        $this->closed = true;
-    }
+	public function close() {
+		$this->closed = true;
+	}
 
-    function append($event)
-    {
-        if ($this->layout !== null) {
-            LoggerLog::debug("LoggerAppenderPhp::append()");
-            $level = $event->getLevel();
-            if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
-                trigger_error($this->layout->format($event), E_USER_ERROR);
-            } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
-                trigger_error($this->layout->format($event), E_USER_WARNING);
-            } else {
-                trigger_error($this->layout->format($event), E_USER_NOTICE);
-            }
-        }
-    }
+	public function append(LoggerLoggingEvent $event) {
+		if($this->layout !== null) {
+			$level = $event->getLevel();
+			if($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
+				trigger_error($this->layout->format($event), E_USER_ERROR);
+			} else if ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
+				trigger_error($this->layout->format($event), E_USER_WARNING);
+			} else {
+				trigger_error($this->layout->format($event), E_USER_NOTICE);
+			}
+		}
+	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderRollingFile.php b/libraries/log4php.debug/appenders/LoggerAppenderRollingFile.php
index 87d1aaba1..a1135f609 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderRollingFile.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderRollingFile.php
@@ -1,20 +1,21 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
 /**
@@ -28,214 +29,210 @@ require_once(LOG4PHP_DIR . '/appenders/LoggerAppenderFile.php');
  * LoggerAppenderRollingFile extends LoggerAppenderFile to backup the log files 
  * when they reach a certain size.
  *
- * <p>Parameters are {@link $maxFileSize}, {@link $maxBackupIndex}.</p> 
+ * Parameters are:
+ *
+ * - layout            - Sets the layout class for this appender
+ * - file              - The target file to write to
+ * - filename          - The target file to write to
+ * - append            - Sets if the appender should append to the end of the file or overwrite content ("true" or "false")
+ * - maxBackupIndex    - Set the maximum number of backup files to keep around (int)
+ * - maxFileSize       - Set the maximum size that the output file is allowed to
+ *                       reach before being rolled over to backup files.
+ *                       Suffixes like "KB", "MB" or "GB" are allowed, f. e. "10KB" is interpreted as 10240
+ * - maximumFileSize   - Alias to MaxFileSize
  *
  * <p>Contributors: Sergio Strampelli.</p>
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.14 $
+ * An example:
+ *
+ * {@example ../../examples/php/appender_socket.php 19}
+ *
+ * {@example ../../examples/resources/appender_socket.properties 18}
+ *
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */
 class LoggerAppenderRollingFile extends LoggerAppenderFile {
 
-    /**
-     * Set the maximum size that the output file is allowed to reach
-     * before being rolled over to backup files.
-     *
-     * <p>In configuration files, the <var>MaxFileSize</var> option takes a
-     * long integer in the range 0 - 2^63. You can specify the value
-     * with the suffixes "KB", "MB" or "GB" so that the integer is
-     * interpreted being expressed respectively in kilobytes, megabytes
-     * or gigabytes. For example, the value "10KB" will be interpreted
-     * as 10240.</p>
-     * <p>The default maximum file size is 10MB.</p>
-     *
-     * <p>Note that MaxFileSize cannot exceed <b>2 GB</b>.</p>
-     *
-     * @var integer
-     */
-    var $maxFileSize = 10485760;
-    
-    /**
-     * Set the maximum number of backup files to keep around.
-     * 
-     * <p>The <var>MaxBackupIndex</var> option determines how many backup
-     * files are kept before the oldest is erased. This option takes
-     * a positive integer value. If set to zero, then there will be no
-     * backup files and the log file will be truncated when it reaches
-     * MaxFileSize.</p>
-     * <p>There is one backup file by default.</p>
-     *
-     * @var integer 
-     */
-    var $maxBackupIndex  = 1;
-    
-    /**
-     * @var string the filename expanded
-     * @access private
-     */
-    var $expandedFileName = null;
-
-    /**
-     * Constructor.
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderRollingFile($name)
-    {
-        $this->LoggerAppenderFile($name);
-    }
-    
-    /**
-     * Returns the value of the MaxBackupIndex option.
-     * @return integer 
-     */
-    function getExpandedFileName() {
-        return $this->expandedFileName;
-    }
-
-    /**
-     * Returns the value of the MaxBackupIndex option.
-     * @return integer 
-     */
-    function getMaxBackupIndex() {
-        return $this->maxBackupIndex;
-    }
+	/**
+	 * Set the maximum size that the output file is allowed to reach
+	 * before being rolled over to backup files.
+	 *
+	 * <p>In configuration files, the <var>MaxFileSize</var> option takes a
+	 * long integer in the range 0 - 2^63. You can specify the value
+	 * with the suffixes "KB", "MB" or "GB" so that the integer is
+	 * interpreted being expressed respectively in kilobytes, megabytes
+	 * or gigabytes. For example, the value "10KB" will be interpreted
+	 * as 10240.</p>
+	 * <p>The default maximum file size is 10MB.</p>
+	 *
+	 * <p>Note that MaxFileSize cannot exceed <b>2 GB</b>.</p>
+	 *
+	 * @var integer
+	 */
+	private $maxFileSize = 10485760;
+	
+	/**
+	 * Set the maximum number of backup files to keep around.
+	 * 
+	 * <p>The <var>MaxBackupIndex</var> option determines how many backup
+	 * files are kept before the oldest is erased. This option takes
+	 * a positive integer value. If set to zero, then there will be no
+	 * backup files and the log file will be truncated when it reaches
+	 * MaxFileSize.</p>
+	 * <p>There is one backup file by default.</p>
+	 *
+	 * @var integer 
+	 */
+	private $maxBackupIndex	 = 1;
+	
+	/**
+	 * @var string the filename expanded
+	 * @access private
+	 */
+	private $expandedFileName = null;
 
-    /**
-     * Get the maximum size that the output file is allowed to reach
-     * before being rolled over to backup files.
-     * @return integer
-     */
-    function getMaximumFileSize() {
-        return $this->maxFileSize;
-    }
+	public function __destruct() {
+       parent::__destruct();
+   	}
+   	
+	/**
+	 * Returns the value of the MaxBackupIndex option.
+	 * @return integer 
+	 */
+	private function getExpandedFileName() {
+		return $this->expandedFileName;
+	}
 
-    /**
-     * Implements the usual roll over behaviour.
-     *
-     * <p>If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex. 
-     * Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.
-     * 
-     * <p>If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.
-     */
-    function rollOver()
-    {
-        // If maxBackups <= 0, then there is no file renaming to be done.
-        if($this->maxBackupIndex > 0) {
-            $fileName = $this->getExpandedFileName();
-            // Delete the oldest file, to keep Windows happy.
-            $file = $fileName . '.' . $this->maxBackupIndex;
-            if (is_writable($file))
-                unlink($file);
-            // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
-            for ($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
-                $file = $fileName . "." . $i;
-                if (is_readable($file)) {
-                    $target = $fileName . '.' . ($i + 1);
-                    rename($file, $target);
-                }
-            }
-    
-            // Rename fileName to fileName.1
-            $target = $fileName . ".1";
-    
-            $this->closeFile(); // keep windows happy.
-    
-            $file = $fileName;
+	/**
+	 * Get the maximum size that the output file is allowed to reach
+	 * before being rolled over to backup files.
+	 * @return integer
+	 */
+	private function getMaximumFileSize() {
+		return $this->maxFileSize;
+	}
 
-	    //As of now suppress the error in rename. we have to handle in future
-            @rename($file, $target);
-        }
-        
-        $this->setFile($fileName, false);
-        unset($this->fp);
-        $this->activateOptions();
-    }
-    
-    function setFileName($fileName)
-    {
-        $this->fileName = $fileName;
-        $this->expandedFileName = realpath($fileName);
-        LoggerLog::debug("LoggerAppenderRollingFile::setFileName():filename=[{$fileName}]:expandedFileName=[{$this->expandedFileName}]");  
-    }
+	/**
+	 * Implements the usual roll over behaviour.
+	 *
+	 * <p>If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex. 
+	 * Moreover, File is renamed File.1 and closed. A new File is created to receive further log output.
+	 * 
+	 * <p>If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.
+	 */
+	private function rollOver() {
+		// If maxBackups <= 0, then there is no file renaming to be done.
+		if($this->maxBackupIndex > 0) {
+			$fileName = $this->getExpandedFileName();
+			// Delete the oldest file, to keep Windows happy.
+			$file = $fileName . '.' . $this->maxBackupIndex;
+			if(is_writable($file))
+				unlink($file);
+			// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
+			for($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
+				$file = $fileName . "." . $i;
+				if(is_readable($file)) {
+					$target = $fileName . '.' . ($i + 1);
+					rename($file, $target);
+				}
+			}
+	
+			$this->close();
+	
+			// Rename fileName to fileName.1
+			$target = $fileName . ".1";
+			$file = $fileName;
+			rename($file, $target);
+		}
+		
+		//unset($this->fp);
+		$this->activateOptions();
+		$this->setFile($fileName, false);
+	}
+	
+	public function setFileName($fileName) {
+		$this->fileName = $fileName;
+		// As LoggerAppenderFile does not create the directory, it has to exist.
+		// realpath() fails if the argument does not exist so the filename is separated.
+		$this->expandedFileName = realpath(dirname($fileName));
+		if ($this->expandedFileName === false) throw new Exception("Directory of $fileName does not exist!");
+		$this->expandedFileName .= '/'.basename($fileName);
+	}
 
 
-    /**
-     * Set the maximum number of backup files to keep around.
-     * 
-     * <p>The <b>MaxBackupIndex</b> option determines how many backup
-     * files are kept before the oldest is erased. This option takes
-     * a positive integer value. If set to zero, then there will be no
-     * backup files and the log file will be truncated when it reaches
-     * MaxFileSize.
-     *
-     * @param mixed $maxBackups
-     */
-    function setMaxBackupIndex($maxBackups)
-    {
-        if (is_numeric($maxBackups))
-            $this->maxBackupIndex = abs((int)$maxBackups);
-    }
+	/**
+	 * Set the maximum number of backup files to keep around.
+	 * 
+	 * <p>The <b>MaxBackupIndex</b> option determines how many backup
+	 * files are kept before the oldest is erased. This option takes
+	 * a positive integer value. If set to zero, then there will be no
+	 * backup files and the log file will be truncated when it reaches
+	 * MaxFileSize.
+	 *
+	 * @param mixed $maxBackups
+	 */
+	public function setMaxBackupIndex($maxBackups) {
+		if(is_numeric($maxBackups)) {
+			$this->maxBackupIndex = abs((int)$maxBackups);
+		}
+	}
 
-    /**
-     * Set the maximum size that the output file is allowed to reach
-     * before being rolled over to backup files.
-     *
-     * @param mixed $maxFileSize
-     * @see setMaxFileSize()
-     */
-    function setMaximumFileSize($maxFileSize)
-    {
-        $this->setMaxFileSize($maxFileSize);
-    }
+	/**
+	 * Set the maximum size that the output file is allowed to reach
+	 * before being rolled over to backup files.
+	 *
+	 * @param mixed $maxFileSize
+	 * @see setMaxFileSize()
+	 * @deprecated
+	 */
+	public function setMaximumFileSize($maxFileSize) {
+		return $this->setMaxFileSize($maxFileSize);
+	}
 
-    /**
-     * Set the maximum size that the output file is allowed to reach
-     * before being rolled over to backup files.
-     * <p>In configuration files, the <b>MaxFileSize</b> option takes an
-     * long integer in the range 0 - 2^63. You can specify the value
-     * with the suffixes "KB", "MB" or "GB" so that the integer is
-     * interpreted being expressed respectively in kilobytes, megabytes
-     * or gigabytes. For example, the value "10KB" will be interpreted
-     * as 10240.
-     *
-     * @param mixed $value
-     */
-    function setMaxFileSize($value)
-    {
-        $maxFileSize = null;
-        $numpart = substr($value,0, strlen($value) -2);
-        $suffix  = strtoupper(substr($value, -2));
+	/**
+	 * Set the maximum size that the output file is allowed to reach
+	 * before being rolled over to backup files.
+	 * <p>In configuration files, the <b>MaxFileSize</b> option takes an
+	 * long integer in the range 0 - 2^63. You can specify the value
+	 * with the suffixes "KB", "MB" or "GB" so that the integer is
+	 * interpreted being expressed respectively in kilobytes, megabytes
+	 * or gigabytes. For example, the value "10KB" will be interpreted
+	 * as 10240.
+	 *
+	 * @param mixed $value
+	 * @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) {
-            LoggerLog::debug("LoggerAppenderRollingFile::setMaxFileSize():value=[$value] wrong declaration");
-        } else {
-            $this->maxFileSize = abs($maxFileSize);
-        }
-    }
+		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;
+	}
 
-    /**
-     * @param LoggerLoggingEvent $event
-     */
-    function append($event)
-    {
-        if ($this->fp) {
-            parent::append($event);
-            if (ftell($this->fp) > $this->getMaximumFileSize())    
-                $this->rollOver();
-        }
-    }
+	/**
+	 * @param LoggerLoggingEvent $event
+	 */
+	public function append(LoggerLoggingEvent $event) {
+		parent::append($event);
+		if(ftell($this->fp) > $this->getMaximumFileSize()) {
+			$this->rollOver();
+		}
+	}
 }
 ?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderSocket.php b/libraries/log4php.debug/appenders/LoggerAppenderSocket.php
index 8bc9dcdf6..cac55456a 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderSocket.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderSocket.php
@@ -1,20 +1,21 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
 /**
@@ -25,261 +26,248 @@ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
 define('LOG4PHP_LOGGER_APPENDER_SOCKET_DEFAULT_PORT',       4446);
 define('LOG4PHP_LOGGER_APPENDER_SOCKET_DEFAULT_TIMEOUT',    30);
 
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
 require_once(LOG4PHP_DIR . '/helpers/LoggerOptionConverter.php');
 require_once(LOG4PHP_DIR . '/LoggerLayout.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
 
 /**
  * Serialize events and send them 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}.
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.17 $
+ * An example:
+ * 
+ * {@example ../../examples/php/appender_socket.php 19}
+ * 
+ * {@example ../../examples/resources/appender_socket.properties 18}
+ * 
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */ 
-class LoggerAppenderSocket extends LoggerAppenderSkeleton {
-
-    /**
-     * @var mixed socket connection resource
-     * @access private
-     */
-    var $sp = false;
-    
-    /**
-     * Target host. On how to define remote hostaname see 
-     * {@link PHP_MANUAL#fsockopen}
-     * @var string 
-     */
-    var $remoteHost     = '';
-    
-    /**
-     * @var integer the network port.
-     */
-    var $port           = LOG4PHP_LOGGER_APPENDER_SOCKET_DEFAULT_PORT;
-    
-    /**
-     * @var boolean get event's location info.
-     */
-    var $locationInfo   = false;
-    
-    /**
-     * @var integer connection timeout
-     */
-    var $timeout        = LOG4PHP_LOGGER_APPENDER_SOCKET_DEFAULT_TIMEOUT;
-    
-    /**
-     * @var boolean output events via {@link LoggerXmlLayout}
-     */
-    var $useXml         = false;
-    
-    /**
-     * @var boolean forward this option to {@link LoggerXmlLayout}. 
-     *              Ignored if {@link $useXml} is <i>false</i>.
-     */
-    var $log4jNamespace = false;
+class LoggerAppenderSocket extends LoggerAppender {
 
-    /**
-     * @var LoggerXmlLayout
-     * @access private
-     */
-    var $xmlLayout      = null;
-    
-    /**
-     * @var boolean
-     * @access private
-     */
-    var $requiresLayout = false;
-    
-    /**
-     * Constructor
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderSocket($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
+	/**
+	 * @var mixed socket connection resource
+	 * @access private
+	 */
+	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.
+	 */
+	private $port = 4446;
+	
+	/**
+	 * @var boolean get event's location info.
+	 */
+	private $locationInfo = false;
+	
+	/**
+	 * @var integer connection timeout
+	 */
+	private $timeout = 30;
+	
+	/**
+	 * @var boolean output events via {@link LoggerXmlLayout}
+	 */
+	private $useXml = false;
+	
+	/**
+	 * @var boolean forward this option to {@link LoggerXmlLayout}. 
+	 *				Ignored if {@link $useXml} is <i>false</i>.
+	 */
+	private $log4jNamespace = false;
 
-    /**
-     * Create a socket connection using defined parameters
-     */
-    function activateOptions()
-    {
-        LoggerLog::debug("LoggerAppenderSocket::activateOptions() creating a socket...");        
-        $errno = 0;
-        $errstr = '';
-        $this->sp = @fsockopen($this->getRemoteHost(), $this->getPort(), $errno, $errstr, $this->getTimeout());
-        if ($errno) {
-            LoggerLog::debug("LoggerAppenderSocket::activateOptions() socket error [$errno] $errstr");
-            $this->closed = true;
-        } else {
-            LoggerLog::debug("LoggerAppenderSocket::activateOptions() socket created [".$this->sp."]");
-            if ($this->getUseXml()) {
-                $this->xmlLayout = LoggerLayout::factory('LoggerXmlLayout');
-                if ($this->xmlLayout === null) {
-                    LoggerLog::debug("LoggerAppenderSocket::activateOptions() useXml is true but layout is null");
-                    $this->setUseXml(false);
-                } else {
-                    $this->xmlLayout->setLocationInfo($this->getLocationInfo());
-                    $this->xmlLayout->setLog4jNamespace($this->getLog4jNamespace());
-                    $this->xmlLayout->activateOptions();
-                }            
-            }
-            $this->closed = false;
-        }
-    }
-    
-    function close()
-    {
-        @fclose($this->sp);
-        $this->closed = true;
-    }
+	/**
+	 * @var LoggerXmlLayout
+	 * @access private
+	 */
+	private $xmlLayout = null;
+	
+	/** @var indiciates if this appender should run in dry mode */
+	private $dry = false;
+	
+	public function __destruct() {
+       $this->close();
+   	}
+   	
+	/**
+	 * 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($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();
+			}			 
+		}
+        $this->closed = false;
+	}
+	
+	public function close() {
+		if($this->closed != true) {
+			if(!$this->dry and $this->sp !== false) {
+				fclose($this->sp);
+			}
+			$this->closed = true;
+		}
+	}
 
-    /**
-     * @return string
-     */
-    function getHostname()
-    {
-        return $this->getRemoteHost();
-    }
-    
-    /**
-     * @return boolean
-     */
-    function getLocationInfo()
-    {
-        return $this->locationInfo;
-    } 
-     
-    /**
-     * @return boolean
-     */
-    function getLog4jNamespace()
-    {
-        return $this->log4jNamespace;
-    }
+	public function setDry($dry) {
+		$this->dry = $dry;
+	}
+	
+	/**
+	 * @return string
+	 */
+	public function getHostname() {
+		return $this->getRemoteHost();
+	}
+	
+	/**
+	 * @return boolean
+	 */
+	public function getLocationInfo() {
+		return $this->locationInfo;
+	} 
+	 
+	/**
+	 * @return boolean
+	 */
+	public function getLog4jNamespace() {
+		return $this->log4jNamespace;
+	}
 
-    /**
-     * @return integer
-     */
-    function getPort()
-    {
-        return $this->port;
-    }
-    
-    function getRemoteHost()
-    {
-        return $this->remoteHost;
-    }
-    
-    /**
-     * @return integer
-     */
-    function getTimeout()
-    {
-        return $this->timeout;
-    }
-    
-    /**
-     * @var boolean
-     */
-    function getUseXml()
-    {
-        return $this->useXml;
-    } 
-     
-    function reset()
-    {
-        $this->close();
-        parent::reset();
-    }
+	/**
+	 * @return integer
+	 */
+	public function getPort() {
+		return $this->port;
+	}
+	
+	public function getRemoteHost() {
+		return $this->remoteHost;
+	}
+	
+	/**
+	 * @return integer
+	 */
+	public function getTimeout() {
+		return $this->timeout;
+	}
+	
+	/**
+	 * @var boolean
+	 */
+	public function getUseXml() {
+		return $this->useXml;
+	} 
+	 
+	public function reset() {
+		$this->close();
+		parent::reset();
+	}
 
-    /**
-     * @param string
-     * @deprecated Please, use {@link setRemoteHost}
-     */
-    function setHostname($hostname)
-    {
-        $this->setRemoteHost($hostname);
-    }
-    
-    /**
-     * @param mixed
-     */
-    function setLocationInfo($flag)
-    {
-        $this->locationInfo = LoggerOptionConverter::toBoolean($flag, $this->getLocationInfo());
-    } 
+	/**
+	 * @param mixed
+	 */
+	public function setLocationInfo($flag) {
+		$this->locationInfo = LoggerOptionConverter::toBoolean($flag, $this->getLocationInfo());
+	} 
 
-    /**
-     * @param mixed
-     */
-    function setLog4jNamespace($flag)
-    {
-        $this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, $this->getLog4jNamespace());
-    } 
-            
-    /**
-     * @param integer
-     */
-    function setPort($port)
-    {
-        $port = LoggerOptionConverter::toInt($port, 0);
-        if ($port > 0 and $port < 65535)
-            $this->port = $port;    
-    }
-    
-    /**
-     * @param string
-     */
-    function setRemoteHost($hostname)
-    {
-        $this->remoteHost = $hostname;
-    }
-    
-    /**
-     * @param integer
-     */
-    function setTimeout($timeout)
-    {
-        $this->timeout = LoggerOptionConverter::toInt($timeout, $this->getTimeout());
-    }
-    
-    /**
-     * @param mixed
-     */
-    function setUseXml($flag)
-    {
-        $this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml());
-    } 
+	/**
+	 * @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;	
+		}
+	}
+	
+	/**
+	 * @param string
+	 */
+	public function setRemoteHost($hostname) {
+		$this->remoteHost = $hostname;
+	}
+	
+	/**
+	 * @param integer
+	 */
+	public function setTimeout($timeout) {
+		$this->timeout = LoggerOptionConverter::toInt($timeout, $this->getTimeout());
+	}
+	
+	/**
+	 * @param mixed
+	 */
+	public function setUseXml($flag) {
+		$this->useXml = LoggerOptionConverter::toBoolean($flag, $this->getUseXml());
+	} 
  
-    /**
-     * @param LoggerLoggingEvent
-     */
-    function append($event)
-    {
-        if ($this->sp) {
-        
-            LoggerLog::debug("LoggerAppenderSocket::append()");
-            
-            if ($this->getLocationInfo())
-                $event->getLocationInfo();
-        
-            if (!$this->getUseXml()) {
-                $sEvent = serialize($event);
-                @fwrite($this->sp, $sEvent, strlen($sEvent));
-            } else {
-                @fwrite($this->sp, $this->xmlLayout->format($event));
-            }            
+	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...
-            @fflush ($this->sp);
-        } 
-    }
+			// not sure about it...
+			if(!$this->dry) {
+				fflush($this->sp);
+			}
+		} 
+	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/appenders/LoggerAppenderSyslog.php b/libraries/log4php.debug/appenders/LoggerAppenderSyslog.php
index 05195bead..034199a4e 100644
--- a/libraries/log4php.debug/appenders/LoggerAppenderSyslog.php
+++ b/libraries/log4php.debug/appenders/LoggerAppenderSyslog.php
@@ -1,85 +1,220 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage appenders
  */
 
 /**
  * @ignore 
  */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-require_once(LOG4PHP_DIR . '/LoggerAppenderSkeleton.php');
+
 require_once(LOG4PHP_DIR . '/LoggerLevel.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
 
 /**
  * Log events using php {@link PHP_MANUAL#syslog} function.
  *
+ * This appender can be configured by changing the following attributes:
+ * 
+ * - 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.
+ *
  * Levels are mapped as follows:
- * - <b>level &gt;= FATAL</b> to LOG_ALERT
- * - <b>FATAL &gt; level &gt;= ERROR</b> to LOG_ERR 
- * - <b>ERROR &gt; level &gt;= WARN</b> to LOG_WARNING
- * - <b>WARN  &gt; level &gt;= INFO</b> to LOG_INFO
- * - <b>INFO  &gt; level &gt;= DEBUG</b> to LOG_DEBUG
+ * - <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
+ *
+ * An example:
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.11 $
+ * {@example ../../examples/php/appender_syslog.php 19}
+ *
+ * {@example ../../examples/resources/appender_syslog.properties 18}
+ *
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage appenders
  */ 
-class LoggerAppenderSyslog extends LoggerAppenderSkeleton {
-    
-    /**
-     * Constructor
-     *
-     * @param string $name appender name
-     */
-    function LoggerAppenderSyslog($name)
-    {
-        $this->LoggerAppenderSkeleton($name);
-    }
+class LoggerAppenderSyslog extends LoggerAppender {
+	
+	/**
+	 * The ident string is added to each message. Typically the name of your application.
+	 *
+	 * @var string Ident for your application
+	 */
+	private $_ident = "Log4PHP Syslog-Event";
+
+	/**
+	 * The priority parameter value indicates the level of importance of the message.
+	 * It is passed on to the Syslog daemon.
+	 * 
+	 * @var int Syslog priority
+	 */
+	private $_priority;
+	
+	/**
+	 * The option used when generating a log message.
+	 * It is passed on to the Syslog daemon.
+	 * 
+	 * @var int Syslog priority
+	 */
+	private $_option;
+	
+	/**
+	 * The facility value indicates the source of the message.
+	 * It is passed on to the Syslog daemon.
+	 *
+	 * @var const int Syslog facility
+	 */
+	private $_facility;
+	
+	/**
+	 * If it is necessary to define logging priority in the .properties-file,
+	 * set this variable to "true".
+	 *
+	 * @var const int  value indicating whether the priority of the message is defined in the .properties-file
+	 *				   (or properties-array)
+	 */
+	private $_overridePriority;
+
+	/** @var indiciates if this appender should run in dry mode */
+	private $dry = false;
+
+	public function __construct($name = '') {
+		parent::__construct($name);
+		$this->requiresLayout = true;
+	}
+
+	public function __destruct() {
+       $this->close();
+   	}
+   	
+   	public function setDry($dry) {
+		$this->dry = $dry;
+	}
+	
+	/**
+	 * Set the ident of the syslog message.
+	 *
+	 * @param string Ident
+	 */
+	public function setIdent($ident) {
+		$this->_ident = $ident; 
+	}
+
+	/**
+	 * Set the priority value for the syslog message.
+	 *
+	 * @param const int Priority
+	 */
+	public function setPriority($priority) {
+		$this->_priority = $priority;
+	}
+	
+	
+	/**
+	 * Set the facility value for the syslog message.
+	 *
+	 * @param const int Facility
+	 */
+	public function setFacility($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".
+	 *
+	 * @param bool Override priority
+	 */
+	public function setOverridePriority($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.
+	 *
+	 * @param string	$option
+	 */
+	public function setOption($option) {	  
+		$this->_option = $option;		
+	}
+	
+	public function activateOptions() {
+		// Deprecated as of 5.3 and removed in 6.0
+		// define_syslog_variables();
+		$this->closed = false;
+	}
 
-    function activateOptions()
-    {
-        define_syslog_variables();
-        $this->closed = false;
-    }
+	public function close() {
+		if($this->closed != true) {
+			closelog();
+			$this->closed = true;
+		}
+	}
 
-    function close() 
-    {
-        closelog();
-        $this->closed = true;
-    }
+	public function append(LoggerLoggingEvent $event) {
+		if($this->_option == NULL){
+			$this->_option = LOG_PID | LOG_CONS;
+		}
+		
+		$level	 = $event->getLevel();
+		if($this->layout === null) {
+			$message = $event->getRenderedMessage();
+		} else {
+			$message = $this->layout->format($event); 
+		}
 
-    function append($event)
-    {
-        $level   = $event->getLevel();
-        $message = $event->getRenderedMessage();
-        if ($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) {
-            syslog(LOG_ALERT, $message);
-        } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
-            syslog(LOG_ERR, $message);        
-        } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
-            syslog(LOG_WARNING, $message);
-        } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) {
-            syslog(LOG_INFO, $message);
-        } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) {
-            syslog(LOG_DEBUG, $message);
-        }
-    }
+		// 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);
+				}
+			}
+			closelog();
+		} else {
+		      echo "DRY MODE OF SYSLOG APPENDER: ".$message;
+		}
+	}
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/configurators/LoggerConfiguratorBasic.php b/libraries/log4php.debug/configurators/LoggerConfiguratorBasic.php
new file mode 100644
index 000000000..5b0ef2003
--- /dev/null
+++ b/libraries/log4php.debug/configurators/LoggerConfiguratorBasic.php
@@ -0,0 +1,47 @@
+<?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);
+	}
+}
diff --git a/libraries/log4php.debug/configurators/LoggerConfiguratorIni.php b/libraries/log4php.debug/configurators/LoggerConfiguratorIni.php
new file mode 100644
index 000000000..df1851119
--- /dev/null
+++ b/libraries/log4php.debug/configurators/LoggerConfiguratorIni.php
@@ -0,0 +1,463 @@
+<?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: 883104 $
+ * @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 || count($properties) == 0) {
+			$error = error_get_last();
+		    throw new LoggerException("LoggerConfiguratorIni: ".$error['message']);
+		}
+		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);
+		
+		// touch additivity only if necessary
+		if(!empty($value)) {
+			$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
new file mode 100644
index 000000000..8b4285a90
--- /dev/null
+++ b/libraries/log4php.debug/configurators/LoggerConfiguratorPhp.php
@@ -0,0 +1,134 @@
+<?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 an external file that 
+ * deliver a PHP array in return.
+ *
+ * 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) {
+		
+		$config = require $url;
+		
+		// set threshold
+		if(isset($config['threshold'])) {
+			$hierarchy->setThreshold(LoggerOptionConverter::toLevel($config['threshold'], LoggerLevel::getLevelAll()));
+		}
+		
+		// parse and create appenders
+		if(isset($config['appenders'])) {
+			
+			foreach($config['appenders'] as $appenderName => $appenderProperties) {
+				
+				$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $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($layout instanceof LoggerLayoutPattern) {
+							$layout->setConversionPattern($appenderProperties['layout']['conversionPattern']);
+						}
+						
+						$appender->setLayout($layout);
+						
+					} else {
+						// TODO: throw exception?
+					}
+					
+				}
+				
+			}
+			
+		}
+		
+		// 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
new file mode 100644
index 000000000..bef41f669
--- /dev/null
+++ b/libraries/log4php.debug/configurators/LoggerConfiguratorXml.php
@@ -0,0 +1,441 @@
+<?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: 883108 $
+ * @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/LoggerFilterDenyAll.php b/libraries/log4php.debug/filters/LoggerFilterDenyAll.php
new file mode 100644
index 000000000..45154786a
--- /dev/null
+++ b/libraries/log4php.debug/filters/LoggerFilterDenyAll.php
@@ -0,0 +1,56 @@
+<?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
+ */
+
+/**
+ * This filter drops all logging events. 
+ * 
+ * You can add this filter to the end of a filter chain to
+ * switch from the default "accept all unless instructed otherwise"
+ * filtering behaviour to a "deny all unless instructed otherwise"
+ * behaviour.
+ * 
+ * <p>
+ * An example for this filter:
+ * 
+ * {@example ../../examples/php/filter_denyall.php 19}
+ *
+ * <p>
+ * The corresponding XML file:
+ * 
+ * {@example ../../examples/resources/filter_denyall.xml 18}
+ *
+ * @version $Revision: 883108 $
+ * @package log4php
+ * @subpackage filters
+ * @since 0.3
+ */
+class LoggerFilterDenyAll extends LoggerFilter {
+
+	/**
+	 * Always returns the integer constant {@link LoggerFilter::DENY}
+	 * regardless of the {@link LoggerLoggingEvent} parameter.
+	 * 
+	 * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to filter.
+	 * @return LoggerFilter::DENY Always returns {@link LoggerFilter::DENY}
+	 */
+	public function decide(LoggerLoggingEvent $event) {
+		return LoggerFilter::DENY;
+	}
+}
diff --git a/libraries/log4php.debug/filters/LoggerFilterLevelMatch.php b/libraries/log4php.debug/filters/LoggerFilterLevelMatch.php
new file mode 100644
index 000000000..02b97dc35
--- /dev/null
+++ b/libraries/log4php.debug/filters/LoggerFilterLevelMatch.php
@@ -0,0 +1,104 @@
+<?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
+ */
+
+/**
+ * This is a very simple filter based on level matching.
+ *
+ * <p>The filter admits two options <b><var>LevelToMatch</var></b> and
+ * <b><var>AcceptOnMatch</var></b>. If there is an exact match between the value
+ * of the <b><var>LevelToMatch</var></b> option and the level of the 
+ * {@link LoggerLoggingEvent}, then the {@link decide()} method returns 
+ * {@link LoggerFilter::ACCEPT} in case the <b><var>AcceptOnMatch</var></b> 
+ * option value is set to <i>true</i>, if it is <i>false</i> then 
+ * {@link LoggerFilter::DENY} is returned. If there is no match, 
+ * {@link LoggerFilter::NEUTRAL} is returned.</p>
+ * 
+ * <p>
+ * An example for this filter:
+ * 
+ * {@example ../../examples/php/filter_levelmatch.php 19}
+ *
+ * <p>
+ * The corresponding XML file:
+ * 
+ * {@example ../../examples/resources/filter_levelmatch.xml 18}
+ * 
+ * @version $Revision: 883108 $
+ * @package log4php
+ * @subpackage filters
+ * @since 0.6
+ */
+class LoggerFilterLevelMatch extends LoggerFilter {
+  
+	/** 
+	 * Indicates if this event should be accepted or denied on match
+	 * @var boolean
+	 */
+	private $acceptOnMatch = true;
+
+	/**
+	 * The level, when to match
+	 * @var LoggerLevel
+	 */
+	private $levelToMatch;
+  
+	/**
+	 * @param boolean $acceptOnMatch
+	 */
+	public function setAcceptOnMatch($acceptOnMatch) {
+		$this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
+	}
+	
+	/**
+	 * @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);
+		}
+	}
+
+	/**
+	 * Return the decision of this filter.
+	 * 
+	 * Returns {@link LoggerFilter::NEUTRAL} if the <b><var>LevelToMatch</var></b>
+	 * option is not set or if there is not match.	Otherwise, if there is a
+	 * match, then the returned decision is {@link LoggerFilter::ACCEPT} if the
+	 * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The
+	 * returned decision is {@link LoggerFilter::DENY} if the
+	 * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>.
+	 *
+	 * @param LoggerLoggingEvent $event
+	 * @return integer
+	 */
+	public function decide(LoggerLoggingEvent $event) {
+		if($this->levelToMatch === null) {
+			return LoggerFilter::NEUTRAL;
+		}
+		
+		if($this->levelToMatch->equals($event->getLevel())) {	
+			return $this->acceptOnMatch ? LoggerFilter::ACCEPT : LoggerFilter::DENY;
+		} else {
+			return LoggerFilter::NEUTRAL;
+		}
+	}
+}
diff --git a/libraries/log4php.debug/filters/LoggerFilterLevelRange.php b/libraries/log4php.debug/filters/LoggerFilterLevelRange.php
new file mode 100644
index 000000000..49ecf8851
--- /dev/null
+++ b/libraries/log4php.debug/filters/LoggerFilterLevelRange.php
@@ -0,0 +1,146 @@
+<?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
+ */
+
+/**
+ * This is a very simple filter based on level matching, which can be
+ * used to reject messages with priorities outside a certain range.
+ *	
+ * <p>The filter admits three options <b><var>LevelMin</var></b>, <b><var>LevelMax</var></b>
+ * and <b><var>AcceptOnMatch</var></b>.</p>
+ *
+ * <p>If the level of the {@link LoggerLoggingEvent} is not between Min and Max
+ * (inclusive), then {@link LoggerFilter::DENY} is returned.</p>
+ *	
+ * <p>If the Logging event level is within the specified range, then if
+ * <b><var>AcceptOnMatch</var></b> is <i>true</i>, 
+ * {@link LoggerFilter::ACCEPT} is returned, and if
+ * <b><var>AcceptOnMatch</var></b> is <i>false</i>, 
+ * {@link LoggerFilter::NEUTRAL} is returned.</p>
+ *	
+ * <p>If <b><var>LevelMin</var></b> is not defined, then there is no
+ * minimum acceptable level (i.e. a level is never rejected for
+ * being too "low"/unimportant).  If <b><var>LevelMax</var></b> is not
+ * defined, then there is no maximum acceptable level (ie a
+ * level is never rejected for being too "high"/important).</p>
+ *
+ * <p>Refer to the {@link LoggerAppender::setThreshold()} method
+ * available to <b>all</b> appenders extending {@link LoggerAppender} 
+ * for a more convenient way to filter out events by level.</p>
+ *
+ * <p>
+ * An example for this filter:
+ * 
+ * {@example ../../examples/php/filter_levelrange.php 19}
+ *
+ * <p>
+ * The corresponding XML file:
+ * 
+ * {@example ../../examples/resources/filter_levelrange.xml 18}
+ *
+ * @author Simon Kitching
+ * @author based on the org.apache.log4j.varia.LevelRangeFilte Java code by Ceki G&uuml;lc&uuml; 
+ *
+ * @version $Revision: 883108 $
+ * @package log4php
+ * @subpackage filters
+ * @since 0.6
+ */
+class LoggerFilterLevelRange extends LoggerFilter {
+
+	/**
+	 * @var boolean
+	 */
+	private $acceptOnMatch = true;
+
+	/**
+	 * @var LoggerLevel
+	 */
+	private $levelMin;
+  
+	/**
+	 * @var LoggerLevel
+	 */
+	private $levelMax;
+
+	/**
+	 * @param boolean $acceptOnMatch
+	 */
+	public function setAcceptOnMatch($acceptOnMatch) {
+		$this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
+	}
+	
+	/**
+	 * @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);
+		}
+	}
+
+	/**
+	 * @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);
+		}
+	}
+
+	/**
+	 * Return the decision of this filter.
+	 *
+	 * @param LoggerLoggingEvent $event
+	 * @return integer
+	 */
+	public function decide(LoggerLoggingEvent $event) {
+		$level = $event->getLevel();
+		
+		if($this->levelMin !== null) {
+			if($level->isGreaterOrEqual($this->levelMin) == false) {
+				// level of event is less than minimum
+				return LoggerFilter::DENY;
+			}
+		}
+
+		if($this->levelMax !== null) {
+			if($level->toInt() > $this->levelMax->toInt()) {
+				// level of event is greater than maximum
+				// Alas, there is no Level.isGreater method. and using
+				// a combo of isGreaterOrEqual && !Equal seems worse than
+				// checking the int values of the level objects..
+				return LoggerFilter::DENY;
+			}
+		}
+
+		if($this->acceptOnMatch) {
+			// this filter set up to bypass later filters and always return
+			// accept if level in range
+			return LoggerFilter::ACCEPT;
+		} else {
+			// event is ok for this filter; allow later filters to have a look..
+			return LoggerFilter::NEUTRAL;
+		}
+	}
+}
diff --git a/libraries/log4php.debug/filters/LoggerFilterStringMatch.php b/libraries/log4php.debug/filters/LoggerFilterStringMatch.php
new file mode 100644
index 000000000..35c4fa586
--- /dev/null
+++ b/libraries/log4php.debug/filters/LoggerFilterStringMatch.php
@@ -0,0 +1,89 @@
+<?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
+ */
+
+/**
+ * This is a very simple filter based on string matching.
+ * 
+ * <p>The filter admits two options {@link $stringToMatch} and
+ * {@link $acceptOnMatch}. If there is a match (using {@link PHP_MANUAL#strpos}
+ * between the value of the {@link $stringToMatch} option and the message 
+ * of the {@link LoggerLoggingEvent},
+ * then the {@link decide()} method returns {@link LoggerFilter::ACCEPT} if
+ * the <b>AcceptOnMatch</b> option value is true, if it is false then
+ * {@link LoggerFilter::DENY} is returned. If there is no match, {@link LoggerFilter::NEUTRAL}
+ * is returned.</p>
+ * 
+ * <p>
+ * An example for this filter:
+ * 
+ * {@example ../../examples/php/filter_stringmatch.php 19}
+ *
+ * <p>
+ * The corresponding XML file:
+ * 
+ * {@example ../../examples/resources/filter_stringmatch.xml 18}
+ *
+ * @version $Revision: 883108 $
+ * @package log4php
+ * @subpackage filters
+ * @since 0.3
+ */
+class LoggerFilterStringMatch extends LoggerFilter {
+
+	/**
+	 * @var boolean
+	 */
+	private $acceptOnMatch = true;
+
+	/**
+	 * @var string
+	 */
+	private $stringToMatch = null;
+
+	/**
+	 * @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');
+	}
+	
+	/**
+	 * @param string $s the string to match
+	 */
+	public function setStringToMatch($s) {
+		$this->stringToMatch = $s;
+	}
+
+	/**
+	 * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
+	 */
+	public function decide(LoggerLoggingEvent $event) {
+		$msg = $event->getRenderedMessage();
+		
+		if($msg === null or $this->stringToMatch === null) {
+			return LoggerFilter::NEUTRAL;
+		}
+		
+		if(strpos($msg, $this->stringToMatch) !== false ) {
+			return ($this->acceptOnMatch) ? LoggerFilter::ACCEPT : LoggerFilter::DENY;
+		}
+		return LoggerFilter::NEUTRAL;
+	}
+}
diff --git a/libraries/log4php.debug/helpers/LoggerBasicPatternConverter.php b/libraries/log4php.debug/helpers/LoggerBasicPatternConverter.php
new file mode 100644
index 000000000..ee081a52c
--- /dev/null
+++ b/libraries/log4php.debug/helpers/LoggerBasicPatternConverter.php
@@ -0,0 +1,71 @@
+<?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
+ */
+
+/**
+ * @package log4php
+ * @subpackage helpers
+ */
+class LoggerBasicPatternConverter extends LoggerPatternConverter {
+
+	/**
+	 * @var integer
+	 */
+	private $type;
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $formattingInfo
+	 * @param integer $type
+	 */
+	public function __construct($formattingInfo, $type) {
+	  parent::__construct($formattingInfo);
+	  $this->type = $type;
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function convert($event) {
+		switch($this->type) {
+			case LoggerPatternParser::RELATIVE_TIME_CONVERTER:
+				$timeStamp = $event->getTimeStamp();
+				$startTime = LoggerLoggingEvent::getStartTime();
+				return (string)(int)($timeStamp * 1000 - $startTime * 1000);
+				
+			case LoggerPatternParser::THREAD_CONVERTER:
+				return $event->getThreadName();
+
+			case LoggerPatternParser::LEVEL_CONVERTER:
+				$level = $event->getLevel();
+				return $level->toString();
+
+			case LoggerPatternParser::NDC_CONVERTER:
+				return $event->getNDC();
+
+			case LoggerPatternParser::MESSAGE_CONVERTER:
+				return $event->getRenderedMessage();
+				
+			default: 
+				return '';
+		}
+	}
+}
diff --git a/libraries/log4php.debug/helpers/LoggerCategoryPatternConverter.php b/libraries/log4php.debug/helpers/LoggerCategoryPatternConverter.php
new file mode 100644
index 000000000..45f77f859
--- /dev/null
+++ b/libraries/log4php.debug/helpers/LoggerCategoryPatternConverter.php
@@ -0,0 +1,44 @@
+<?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
+ */
+
+/**
+ * @package log4php
+ * @subpackage helpers
+ */
+class LoggerCategoryPatternConverter extends LoggerNamedPatternConverter {
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $formattingInfo
+	 * @param integer $precision
+	 */
+	public function __construct($formattingInfo, $precision) {
+		parent::__construct($formattingInfo, $precision);
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function getFullyQualifiedName($event) {
+		return $event->getLoggerName();
+	}
+}
diff --git a/libraries/log4php.debug/helpers/LoggerClassNamePatternConverter.php b/libraries/log4php.debug/helpers/LoggerClassNamePatternConverter.php
new file mode 100644
index 000000000..a067c9d5a
--- /dev/null
+++ b/libraries/log4php.debug/helpers/LoggerClassNamePatternConverter.php
@@ -0,0 +1,45 @@
+<?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
+ */
+
+/**
+ * @package log4php
+ * @subpackage helpers
+ */
+class LoggerClassNamePatternConverter extends LoggerNamedPatternConverter {
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $formattingInfo
+	 * @param integer $precision
+	 */
+	public function __construct($formattingInfo, $precision) {
+		parent::__construct($formattingInfo, $precision);
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function getFullyQualifiedName($event) {
+		return $event->fqcn;
+	}
+}
+
diff --git a/libraries/log4php.debug/helpers/LoggerDatePatternConverter.php b/libraries/log4php.debug/helpers/LoggerDatePatternConverter.php
new file mode 100644
index 000000000..ee5ddcf8c
--- /dev/null
+++ b/libraries/log4php.debug/helpers/LoggerDatePatternConverter.php
@@ -0,0 +1,53 @@
+<?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
+ */
+
+/**
+ * @package log4php
+ * @subpackage helpers
+ */
+class LoggerDatePatternConverter extends LoggerPatternConverter {
+
+	/**
+	 * @var string
+	 */
+	private $df;
+	
+	/**
+	 * Constructor
+	 *
+	 * @param string $formattingInfo
+	 * @param string $df
+	 */
+	public function __construct($formattingInfo, $df) {
+		parent::__construct($formattingInfo);
+		$this->df = $df;
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function convert($event) {
+		$timeStamp = $event->getTimeStamp();
+		$usecs = round(($timeStamp - (int)$timeStamp) * 1000);
+		$this->df = preg_replace('/((?<!\\\\)(?:\\\\{2})*)u/', '${1}' . sprintf('%03d', $usecs), $this->df);
+		return date($this->df, $event->getTimeStamp());
+	}
+}
diff --git a/libraries/log4php.debug/helpers/LoggerFormattingInfo.php b/libraries/log4php.debug/helpers/LoggerFormattingInfo.php
index f642b6343..a3217c1ab 100644
--- a/libraries/log4php.debug/helpers/LoggerFormattingInfo.php
+++ b/libraries/log4php.debug/helpers/LoggerFormattingInfo.php
@@ -1,18 +1,20 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
  * @subpackage helpers
  */
@@ -24,38 +26,34 @@ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
  
 /**
  */
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
 
 /**
  * This class encapsulates the information obtained when parsing
  * formatting modifiers in conversion modifiers.
  * 
- * @author VxR <vxr@vxr.it>
  * @package log4php
- * @subpackage spi
+ * @subpackage helpers
  * @since 0.3
  */
 class LoggerFormattingInfo {
 
-    var $min        = -1;
-    var $max        = 0x7FFFFFFF;
-    var $leftAlign  = false;
+	public $min = -1;
+	public $max = 0x7FFFFFFF;
+	public $leftAlign = false;
 
-    /**
-     * Constructor
-     */
-    function LoggerFormattingInfo() {}
-    
-    function reset()
-    {
-        $this->min          = -1;
-        $this->max          = 0x7FFFFFFF;
-        $this->leftAlign    = false;      
-    }
+	/**
+	 * Constructor
+	 */
+	public function __construct() {}
+	
+	public function reset() {
+		$this->min = -1;
+		$this->max = 0x7FFFFFFF;
+		$this->leftAlign = false;	  
+	}
 
-    function dump()
-    {
-        LoggerLog::debug("LoggerFormattingInfo::dump() min={$this->min}, max={$this->max}, leftAlign={$this->leftAlign}");
-    }
-} 
-?>
\ No newline at end of file
+	public function dump() {
+		// TODO: other option to dump?
+		// LoggerLog::debug("LoggerFormattingInfo::dump() min={$this->min}, max={$this->max}, leftAlign={$this->leftAlign}");
+	}
+}
diff --git a/libraries/log4php.debug/helpers/LoggerLiteralPatternConverter.php b/libraries/log4php.debug/helpers/LoggerLiteralPatternConverter.php
new file mode 100644
index 000000000..737af8550
--- /dev/null
+++ b/libraries/log4php.debug/helpers/LoggerLiteralPatternConverter.php
@@ -0,0 +1,57 @@
+<?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
+ */
+
+/**
+ * @package log4php
+ * @subpackage helpers
+ */
+class LoggerLiteralPatternConverter extends LoggerPatternConverter {
+	
+	/**
+	 * @var string
+	 */
+	private $literal;
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $value
+	 */
+	public function __construct($value) {
+		$this->literal = $value;
+	}
+
+	/**
+	 * @param string &$sbuf
+	 * @param LoggerLoggingEvent $event
+	 */
+	public function format(&$sbuf, $event) {
+		$sbuf .= $this->literal;
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function convert($event) {
+		return $this->literal;
+	}
+}
+
diff --git a/libraries/log4php.debug/helpers/LoggerLocationPatternConverter.php b/libraries/log4php.debug/helpers/LoggerLocationPatternConverter.php
new file mode 100644
index 000000000..f3f0d2e8d
--- /dev/null
+++ b/libraries/log4php.debug/helpers/LoggerLocationPatternConverter.php
@@ -0,0 +1,63 @@
+<?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
+ */
+
+/**
+ * @package log4php
+ * @subpackage helpers
+ */
+class LoggerLocationPatternConverter extends LoggerPatternConverter {
+	
+	/**
+	 * @var integer
+	 */
+	private $type;
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $formattingInfo
+	 * @param integer $type
+	 */
+	public function __construct($formattingInfo, $type) {
+	  parent::__construct($formattingInfo);
+	  $this->type = $type;
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function convert($event) {
+		$locationInfo = $event->getLocationInformation();
+		switch($this->type) {
+			case LoggerPatternParser::FULL_LOCATION_CONVERTER:
+				return $locationInfo->getFullInfo();
+			case LoggerPatternParser::METHOD_LOCATION_CONVERTER:
+				return $locationInfo->getMethodName();
+			case LoggerPatternParser::LINE_LOCATION_CONVERTER:
+				return $locationInfo->getLineNumber();
+			case LoggerPatternParser::FILE_LOCATION_CONVERTER:
+				return $locationInfo->getFileName();
+			default: 
+				return '';
+		}
+	}
+}
+
diff --git a/libraries/log4php.debug/helpers/LoggerMDCPatternConverter.php b/libraries/log4php.debug/helpers/LoggerMDCPatternConverter.php
new file mode 100644
index 000000000..8c835ace3
--- /dev/null
+++ b/libraries/log4php.debug/helpers/LoggerMDCPatternConverter.php
@@ -0,0 +1,50 @@
+<?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
+ */
+
+/**
+ * @package log4php
+ * @subpackage helpers
+ */
+class LoggerMDCPatternConverter extends LoggerPatternConverter {
+
+	/**
+	 * @var string
+	 */
+	private $key;
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $formattingInfo
+	 * @param string $key
+	 */
+	public function __construct($formattingInfo, $key) {
+		parent::__construct($formattingInfo);
+		$this->key = $key;
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function convert($event) {
+		return $event->getMDC($this->key);
+	}
+}
diff --git a/libraries/log4php.debug/helpers/LoggerNamedPatternConverter.php b/libraries/log4php.debug/helpers/LoggerNamedPatternConverter.php
new file mode 100644
index 000000000..19051ab15
--- /dev/null
+++ b/libraries/log4php.debug/helpers/LoggerNamedPatternConverter.php
@@ -0,0 +1,77 @@
+<?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
+ */
+
+/**
+ * @package log4php
+ * @subpackage helpers
+ * @abstract
+ */
+class LoggerNamedPatternConverter extends LoggerPatternConverter {
+
+	/**
+	 * @var integer
+	 */
+	private $precision;
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $formattingInfo
+	 * @param integer $precision
+	 */
+	public function __construct($formattingInfo, $precision) {
+	  parent::__construct($formattingInfo);
+	  $this->precision =  $precision;
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 * @abstract
+	 */
+	public function getFullyQualifiedName($event) {
+		// abstract
+		return;
+	}
+
+	/**
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	function convert($event) {
+		$n = $this->getFullyQualifiedName($event);
+		if($this->precision <= 0) {
+			return $n;
+		} else {
+			$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
+			// precision is 1 and the category name ends with a dot.
+			$end = $len -1 ;
+			for($i = $this->precision; $i > 0; $i--) {
+				$end = strrpos(substr($n, 0, ($end - 1)), '.');
+				if($end == false) {
+					return $n;
+				}
+			}
+			return substr($n, ($end + 1), $len);
+		}
+	}
+}
diff --git a/libraries/log4php.debug/helpers/LoggerOptionConverter.php b/libraries/log4php.debug/helpers/LoggerOptionConverter.php
index 0dd143942..9c387eb76 100644
--- a/libraries/log4php.debug/helpers/LoggerOptionConverter.php
+++ b/libraries/log4php.debug/helpers/LoggerOptionConverter.php
@@ -1,20 +1,21 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage helpers
  */
 
 /**
@@ -24,16 +25,10 @@ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
 
 require_once(LOG4PHP_DIR . '/LoggerLevel.php');
 
-define('LOG4PHP_OPTION_CONVERTER_DELIM_START',      '${');
-define('LOG4PHP_OPTION_CONVERTER_DELIM_STOP',       '}');
-define('LOG4PHP_OPTION_CONVERTER_DELIM_START_LEN',  2);
-define('LOG4PHP_OPTION_CONVERTER_DELIM_STOP_LEN',   1);
-
 /**
  * A convenience class to convert property values to specific types.
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.6 $ 
+ * @version $Revision: 822464 $ 
  * @package log4php
  * @subpackage helpers
  * @static
@@ -41,310 +36,295 @@ define('LOG4PHP_OPTION_CONVERTER_DELIM_STOP_LEN',   1);
  */
 class LoggerOptionConverter {
 
-    /** 
-     * OptionConverter is a static class. 
-     */
-    function OptionConverter() 
-    {
-        return;
-    }
+	const DELIM_START = '${';
+	const DELIM_STOP = '}';
+	const DELIM_START_LEN = 2;
+	const DELIM_STOP_LEN = 1;
 
-    /**
-     * @param array $l
-     * @param array $r
-     * @return array
-     *
-     * @static
-     */
-    function concatanateArrays($l, $r)
-    {
-        return array_merge($l, $r);
-    }
+   /**
+	* Read a predefined var.
+	*
+	* It returns a value referenced by <var>$key</var> using this search criteria:
+	* - if <var>$key</var> is a constant then return it. Else
+	* - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
+	* - return <var>$def</var>. 
+	*
+	* @param string $key The key to search for.
+	* @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)) {
+			return (string)constant($key);
+		} else if(isset($_SERVER[$key])) {
+			return (string)$_SERVER[$key];
+		} else if(isset($_ENV[$key])) {
+			return (string)$_ENV[$key];
+		} else {
+			return $def;
+		}
+	}
 
-    /**
-    * Read a predefined var.
-    *
-    * It returns a value referenced by <var>$key</var> using this search criteria:
-    * - if <var>$key</var> is a constant then return it. Else
-    * - if <var>$key</var> is set in <var>$_ENV</var> then return it. Else
-    * - return <var>$def</var>. 
-    *
-    * @param string $key The key to search for.
-    * @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
-    */
-    function getSystemProperty($key, $def)
-    {
-        LoggerLog::debug("LoggerOptionConverter::getSystemProperty():key=[{$key}]:def=[{$def}].");
+	/**
+	 * If <var>$value</var> is <i>true</i>, then <i>true</i> is
+	 * returned. If <var>$value</var> is <i>false</i>, then
+	 * <i>true</i> is returned. Otherwise, <var>$default</var> is
+	 * returned.
+	 *
+	 * <p>Case of value is unimportant.</p>
+	 *
+	 * @param string $value
+	 * @param boolean $default
+	 * @return boolean
+	 *
+	 * @static
+	 */
+	public static function toBoolean($value, $default=true) {
+	    if (is_null($value)) {
+			return $default;
+	    } elseif (is_string($value)) {
+		$trimmedVal = strtolower(trim($value));
+	
+            if("1" == $trimmedVal or "true" == $trimmedVal or "yes" == $trimmedVal or "on" == $trimmedVal) {
+			return true;
+            } else if ("" == $trimmedVal or "0" == $trimmedVal or "false" == $trimmedVal or "no" == $trimmedVal or "off" == $trimmedVal) {
+			return false;
+		}
+		} elseif (is_bool($value)) {
+		    return $value;
+		} elseif (is_int($value)) {
+		    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;
+	}
 
-        if (defined($key)) {
-            return (string)constant($key);
-        } elseif (isset($_ENV[$key])) {
-            return (string)$_ENV[$key];
-        } else {
-            return $def;
-        }
-    }
+	/**
+	 * @param string $value
+	 * @param integer $default
+	 * @return integer
+	 * @static
+	 */
+	public static function toInt($value, $default) {
+		$value = trim($value);
+		if(is_numeric($value)) {
+			return (int)$value;
+		} else {
+			return $default;
+		}
+	}
 
-    /**
-     * If <var>$value</var> is <i>true</i>, then <i>true</i> is
-     * returned. If <var>$value</var> is <i>false</i>, then
-     * <i>true</i> is returned. Otherwise, <var>$default</var> is
-     * returned.
-     *
-     * <p>Case of value is unimportant.</p>
-     *
-     * @param string $value
-     * @param boolean $default
-     * @return boolean
-     *
-     * @static
-     */
-    function toBoolean($value, $default)
-    {
-        if($value === null)
-            return $default;
-        if ($value == 1)
-            return true;
-        $trimmedVal = strtolower(trim($value));
-        if ("true" == $trimmedVal or "yes" == $trimmedVal)
-            return true;
-        if ("false" == $trimmedVal)
-            return false;
-        return $default;
-    }
+	/**
+	 * Converts a standard or custom priority level to a Level
+	 * object.
+	 *
+	 * <p> If <var>$value</var> is of form "<b>level#full_file_classname</b>",
+	 * where <i>full_file_classname</i> means the class filename with path
+	 * but without php extension, then the specified class' <i>toLevel()</i> method
+	 * is called to process the specified level string; if no '#'
+	 * character is present, then the default {@link LoggerLevel}
+	 * class is used to process the level value.</p>
+	 *
+	 * <p>As a special case, if the <var>$value</var> parameter is
+	 * equal to the string "NULL", then the value <i>null</i> will
+	 * be returned.</p>
+	 *
+	 * <p>If any error occurs while converting the value to a level,
+	 * the <var>$defaultValue</var> parameter, which may be
+	 * <i>null</i>, is returned.</p>
+	 *
+	 * <p>Case of <var>$value</var> is insignificant for the level level, but is
+	 * significant for the class name part, if present.</p>
+	 *
+	 * @param string $value
+	 * @param LoggerLevel $defaultValue
+	 * @return LoggerLevel a {@link LoggerLevel} or null
+	 * @static
+	 */
+	public static function toLevel($value, $defaultValue) {
+		if($value === null) {
+			return $defaultValue;
+		}
+		$hashIndex = strpos($value, '#');
+		if($hashIndex === false) {
+			if("NULL" == strtoupper($value)) {
+				return null;
+			} else {
+				// no class name specified : use standard Level class
+				return LoggerLevel::toLevel($value, $defaultValue);
+			}
+		}
 
-    /**
-     * @param string $value
-     * @param integer $default
-     * @return integer
-     * @static
-     */
-    function toInt($value, $default)
-    {
-        $value = trim($value);
-        if (is_numeric($value)) {
-            return (int)$value;
-        } else {
-            return $default;
-        }
-    }
+		$result = $defaultValue;
 
-    /**
-     * Converts a standard or custom priority level to a Level
-     * object.
-     *
-     * <p> If <var>$value</var> is of form "<b>level#full_file_classname</b>",
-     * where <i>full_file_classname</i> means the class filename with path
-     * but without php extension, then the specified class' <i>toLevel()</i> method
-     * is called to process the specified level string; if no '#'
-     * character is present, then the default {@link LoggerLevel}
-     * class is used to process the level value.</p>
-     *
-     * <p>As a special case, if the <var>$value</var> parameter is
-     * equal to the string "NULL", then the value <i>null</i> will
-     * be returned.</p>
-     *
-     * <p>If any error occurs while converting the value to a level,
-     * the <var>$defaultValue</var> parameter, which may be
-     * <i>null</i>, is returned.</p>
-     *
-     * <p>Case of <var>$value</var> is insignificant for the level level, but is
-     * significant for the class name part, if present.</p>
-     *
-     * @param string $value
-     * @param LoggerLevel $defaultValue
-     * @return LoggerLevel a {@link LoggerLevel} or null
-     * @static
-     */
-    function toLevel($value, $defaultValue)
-    {
-        if($value === null)
-            return $defaultValue;
+		$clazz = substr($value, ($hashIndex + 1));
+		$levelName = substr($value, 0, $hashIndex);
 
-        $hashIndex = strpos($value, '#');
-        if ($hashIndex === false) {
-            if("NULL" == strtoupper($value)) {
-	            return null;
-            } else {
-	            // no class name specified : use standard Level class
-	            return LoggerLevel::toLevel($value, $defaultValue);
-            }
-        }
+		// This is degenerate case but you never know.
+		if("NULL" == strtoupper($levelName)) {
+			return null;
+		}
 
-        $result = $defaultValue;
+		$clazz = basename($clazz);
 
-        $clazz = substr($value, ($hashIndex + 1));
-        $levelName = substr($value, 0, $hashIndex);
+		if(class_exists($clazz)) {
+			$result = @call_user_func(array($clazz, 'toLevel'), $levelName, $defaultValue);
+			if(!$result instanceof LoggerLevel) {
+				$result = $defaultValue;
+			}
+		} 
+		return $result;
+	}
 
-        // This is degenerate case but you never know.
-        if("NULL" == strtoupper($levelName)) {
-        	return null;
-        }
+	/**
+	 * @param string $value
+	 * @param float $default
+	 * @return float
+	 *
+	 * @static
+	 */
+	public static function toFileSize($value, $default) {
+		if($value === null) {
+			return $default;
+		}
 
-        LoggerLog::debug("LoggerOptionConverter::toLevel():class=[{$clazz}]:pri=[{$levelName}]");
+		$s = strtoupper(trim($value));
+		$multiplier = (float)1;
+		if(($index = strpos($s, 'KB')) !== false) {
+			$multiplier = 1024;
+			$s = substr($s, 0, $index);
+		} else if(($index = strpos($s, 'MB')) !== false) {
+			$multiplier = 1024 * 1024;
+			$s = substr($s, 0, $index);
+		} else if(($index = strpos($s, 'GB')) !== false) {
+			$multiplier = 1024 * 1024 * 1024;
+			$s = substr($s, 0, $index);
+		}
+		if(is_numeric($s)) {
+			return (float)$s * $multiplier;
+		} 
+		return $default;
+	}
 
-        if (!class_exists($clazz))
-            @include_once("{$clazz}.php");
+	/**
+	 * Find the value corresponding to <var>$key</var> in
+	 * <var>$props</var>. Then perform variable substitution on the
+	 * found value.
+	 *
+	 * @param string $key
+	 * @param array $props
+	 * @return string
+	 *
+	 * @static
+	 */
+	public static function findAndSubst($key, $props) {
+		$value = @$props[$key];
 
-        $clazz = basename($clazz);
-
-        if (class_exists($clazz)) {
-            $result = @call_user_func(array($clazz, 'toLevel'), $value, $defaultValue);
-            if (!is_a($result, 'loggerlevel')) {
-                LoggerLog::debug("LoggerOptionConverter::toLevel():class=[{$clazz}] cannot call toLevel(). Returning default.");            
-                $result = $defaultValue;
-            }
-        } else {
-            LoggerLog::warn("LoggerOptionConverter::toLevel() class '{$clazz}' doesnt exists.");
-        }
-        return $result;
+        // If coming from the LoggerConfiguratorIni, some options were
+        // already mangled by parse_ini_file:
+        //
+        // not specified      => never reaches this code
+        // ""|off|false|null  => string(0) ""
+        // "1"|on|true        => string(1) "1"
+        // "true"             => string(4) "true"
+        // "false"            => string(5) "false"
+        // 
+        // As the integer 1 and the boolean true are therefore indistinguable
+        // it's up to the setter how to deal with it, they can not be cast
+        // into a boolean here. {@see toBoolean}
+        // Even an empty value has to be given to the setter as it has been
+        // explicitly set by the user and is different from an option which
+        // has not been specified and therefore keeps its default value.
+        //
+		// if(!empty($value)) {
+			return LoggerOptionConverter::substVars($value, $props);
+		// }
     }
 
-    /**
-     * @param string $value
-     * @param float $default
-     * @return float
-     *
-     * @static
-     */
-    function toFileSize($value, $default)
-    {
-        if ($value === null)
-            return $default;
-
-        $s = strtoupper(trim($value));
-        $multiplier = (float)1;
-        if(($index = strpos($s, 'KB')) !== false) {
-            $multiplier = 1024;
-            $s = substr($s, 0, $index);
-        } elseif(($index = strpos($s, 'MB')) !== false) {
-            $multiplier = 1024 * 1024;
-            $s = substr($s, 0, $index);
-        } elseif(($index = strpos($s, 'GB')) !== false) {
-            $multiplier = 1024 * 1024 * 1024;
-            $s = substr($s, 0, $index);
-        }
-        if(is_numeric($s)) {
-            return (float)$s * $multiplier;
-        } else {
-            LoggerLog::warn("LoggerOptionConverter::toFileSize() [{$s}] is not in proper form.");
-        }
-        return $default;
-    }
+	/**
+	 * Perform variable substitution in string <var>$val</var> from the
+	 * values of keys found with the {@link getSystemProperty()} method.
+	 * 
+	 * <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
+	 * 
+	 * <p>For example, if the "MY_CONSTANT" contains "value", then
+	 * the call
+	 * <code>
+	 * $s = LoggerOptionConverter::substituteVars("Value of key is ${MY_CONSTANT}.");
+	 * </code>
+	 * will set the variable <i>$s</i> to "Value of key is value.".</p>
+	 * 
+	 * <p>If no value could be found for the specified key, then the
+	 * <var>$props</var> parameter is searched, if the value could not
+	 * be found there, then substitution defaults to the empty string.</p>
+	 * 
+	 * <p>For example, if {@link getSystemProperty()} cannot find any value for the key
+	 * "inexistentKey", then the call
+	 * <code>
+	 * $s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
+	 * </code>
+	 * will set <var>$s</var> to "Value of inexistentKey is []".</p>
+	 * 
+	 * <p>A warn is thrown if <var>$val</var> contains a start delimeter "${" 
+	 * which is not balanced by a stop delimeter "}" and an empty string is returned.</p>
+	 * 
+	 * @author Avy Sharell
+	 * 
+	 * @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) {
+		$sbuf = '';
+		$i = 0;
+		while(true) {
+			$j = strpos($val, self::DELIM_START, $i);
+			if($j === false) {
+				// no more variables
+				if($i == 0) { // this is a simple string
+					return $val;
+				} else { // add the tail string which contails no variables and return the result.
+					$sbuf .= substr($val, $i);
+					return $sbuf;
+				}
+			} else {
+			
+				$sbuf .= substr($val, $i, $j-$i);
+				$k = strpos($val, self::DELIM_STOP, $j);
+				if($k === false) {
+					// LoggerOptionConverter::substVars() has no closing brace. Opening brace
+					return '';
+				} else {
+					$j += self::START_LEN;
+					$key = substr($val, $j, $k - $j);
+					// first try in System properties
+					$replacement = LoggerOptionConverter::getSystemProperty($key, null);
+					// then try props parameter
+					if($replacement == null and $props !== null) {
+						$replacement = @$props[$key];
+					}
 
-    /**
-     * Find the value corresponding to <var>$key</var> in
-     * <var>$props</var>. Then perform variable substitution on the
-     * found value.
-     *
-     * @param string $key
-     * @param array $props
-     * @return string
-     *
-     * @static
-     */
-    function findAndSubst($key, $props)
-    {
-        $value = @$props[$key];
-        if(empty($value)) {
-            return null;
-        }
-        return LoggerOptionConverter::substVars($value, $props);
-    }
-
-    /**
-     * Perform variable substitution in string <var>$val</var> from the
-     * values of keys found with the {@link getSystemProperty()} method.
-     * 
-     * <p>The variable substitution delimeters are <b>${</b> and <b>}</b>.
-     * 
-     * <p>For example, if the "MY_CONSTANT" contains "value", then
-     * the call
-     * <code>
-     * $s = LoggerOptionConverter::substituteVars("Value of key is ${MY_CONSTANT}.");
-     * </code>
-     * will set the variable <i>$s</i> to "Value of key is value.".</p>
-     * 
-     * <p>If no value could be found for the specified key, then the
-     * <var>$props</var> parameter is searched, if the value could not
-     * be found there, then substitution defaults to the empty string.</p>
-     * 
-     * <p>For example, if {@link getSystemProperty()} cannot find any value for the key
-     * "inexistentKey", then the call
-     * <code>
-     * $s = LoggerOptionConverter::substVars("Value of inexistentKey is [${inexistentKey}]");
-     * </code>
-     * will set <var>$s</var> to "Value of inexistentKey is []".</p>
-     * 
-     * <p>A warn is thrown if <var>$val</var> contains a start delimeter "${" 
-     * which is not balanced by a stop delimeter "}" and an empty string is returned.</p>
-     * 
-     * @log4j-author Avy Sharell
-     * 
-     * @param string $val The string on which variable substitution is performed.
-     * @param array $props
-     * @return string
-     *
-     * @static
-     */
-    function substVars($val, $props = null)
-    {
-        LoggerLog::debug("LoggerOptionConverter::substVars():val=[{$val}]");
-        
-        $sbuf = '';
-        $i = 0;
-        while(true) {
-            $j = strpos($val, LOG4PHP_OPTION_CONVERTER_DELIM_START, $i);
-            if ($j === false) {
-                LoggerLog::debug("LoggerOptionConverter::substVars() no more variables");
-	            // no more variables
-	            if ($i == 0) { // this is a simple string
-                    LoggerLog::debug("LoggerOptionConverter::substVars() simple string");
-	                return $val;
-            	} else { // add the tail string which contails no variables and return the result.
-                    $sbuf .= substr($val, $i);
-                    LoggerLog::debug("LoggerOptionConverter::substVars():sbuf=[{$sbuf}]. Returning sbuf");                    
-                    return $sbuf;
-	            }
-            } else {
-            
-	            $sbuf .= substr($val, $i, $j-$i);
-                LoggerLog::debug("LoggerOptionConverter::substVars():sbuf=[{$sbuf}]:i={$i}:j={$j}.");
-            	$k = strpos($val, LOG4PHP_OPTION_CONVERTER_DELIM_STOP, $j);
-            	if ($k === false) {
-                    LoggerLog::warn(
-                        "LoggerOptionConverter::substVars() " .
-                        "'{$val}' has no closing brace. Opening brace at position {$j}."
-                    );
-                    return '';
-	            } else {
-	                $j += LOG4PHP_OPTION_CONVERTER_DELIM_START_LEN;
-	                $key = substr($val, $j, $k - $j);
-                    // first try in System properties
-	                $replacement = LoggerOptionConverter::getSystemProperty($key, null);
-	                // then try props parameter
-	                if($replacement == null and $props !== null) {
-            	        $replacement = @$props[$key];
-	                }
-
-                    if(!empty($replacement)) {
-	                    // Do variable substitution on the replacement string
-                	    // such that we can solve "Hello ${x2}" as "Hello p1" 
-                        // the where the properties are
-                	    // x1=p1
-                        // x2=${x1}
-	                    $recursiveReplacement = LoggerOptionConverter::substVars($replacement, $props);
-                	    $sbuf .= $recursiveReplacement;
-	                }
-	                $i = $k + LOG4PHP_OPTION_CONVERTER_DELIM_STOP_LEN;
-	            }
-            }
-        }
-    }
+					if(!empty($replacement)) {
+						// Do variable substitution on the replacement string
+						// such that we can solve "Hello ${x2}" as "Hello p1" 
+						// the where the properties are
+						// x1=p1
+						// x2=${x1}
+						$recursiveReplacement = LoggerOptionConverter::substVars($replacement, $props);
+						$sbuf .= $recursiveReplacement;
+					}
+					$i = $k + self::DELIM_STOP_LEN;
+				}
+			}
+		}
+	}
 
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/helpers/LoggerPatternConverter.php b/libraries/log4php.debug/helpers/LoggerPatternConverter.php
index 3d68be813..b0c22df1c 100644
--- a/libraries/log4php.debug/helpers/LoggerPatternConverter.php
+++ b/libraries/log4php.debug/helpers/LoggerPatternConverter.php
@@ -1,38 +1,41 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage helpers
  */
 
 /**
- * @ignore 
+ * Array for fast space padding
+ * Used by {@link LoggerPatternConverter::spacePad()}.	
+ * 
+ * @package log4php
+ * @subpackage helpers
  */
+
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
 
-/**
- */
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
+$GLOBALS['log4php.LoggerPatternConverter.spaces'] = array(
+	" ", // 1 space
+	"  ", // 2 spaces
+	"    ", // 4 spaces
+	"        ", // 8 spaces
+	"                ", // 16 spaces
+	"                                " ); // 32 spaces
 
-/**
- * Array for fast space padding
- * Used by {@link LoggerPatternConverter::spacePad()}.  
- */
-$GLOBALS['log4php.LoggerPatternConverter.spaces'] = array(" ", "  ", "    ", "        ", //1,2,4,8 spaces
-			    "                ", // 16 spaces
-			    "                                " ); // 32 spaces
 
 /**
  * LoggerPatternConverter is an abstract class that provides the formatting 
@@ -42,8 +45,7 @@ $GLOBALS['log4php.LoggerPatternConverter.spaces'] = array(" ", "  ", "    ", "
  * individual PatternConverters. Each of which is responsible for
  * converting a logging event in a converter specific manner.</p>
  * 
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.13 $
+ * @version $Revision: 822445 $
  * @package log4php
  * @subpackage helpers
  * @abstract
@@ -51,101 +53,91 @@ $GLOBALS['log4php.LoggerPatternConverter.spaces'] = array(" ", "  ", "    ", "
  */
 class LoggerPatternConverter {
 
-    /**
-     * @var LoggerPatternConverter next converter in converter chain
-     */
-    var $next = null;
-    
-    var $min = -1;
-    var $max = 0x7FFFFFFF;
-    var $leftAlign = false;
-
-    /**
-     * Constructor 
-     *
-     * @param LoggerFormattingInfo $fi
-     */
-    function LoggerPatternConverter($fi = null) 
-    {  
-        if ($fi !== null) {
-            $this->min = $fi->min;
-            $this->max = $fi->max;
-            $this->leftAlign = $fi->leftAlign;
-        }
-    }
+	/**
+	 * @var LoggerPatternConverter next converter in converter chain
+	 */
+	public $next = null;
+	
+	public $min = -1;
+	public $max = 0x7FFFFFFF;
+	public $leftAlign = false;
+
+	/**
+	 * Constructor 
+	 *
+	 * @param LoggerFormattingInfo $fi
+	 */
+	public function __construct($fi = null) {  
+		if($fi !== null) {
+			$this->min = $fi->min;
+			$this->max = $fi->max;
+			$this->leftAlign = $fi->leftAlign;
+		}
+	}
   
-    /**
-     * Derived pattern converters must override this method in order to
-     * convert conversion specifiers in the correct way.
-     *
-     * @param LoggerLoggingEvent $event
-     */
-    function convert($event) {}
-
-    /**
-     * A template method for formatting in a converter specific way.
-     *
-     * @param string &$sbuf string buffer
-     * @param LoggerLoggingEvent $e
-     */
-    function format(&$sbuf, $e)
-    {
-        LoggerLog::debug("LoggerPatternConverter::format() sbuf='$sbuf'");    
-    
-        $s = $this->convert($e);
-        
-        LoggerLog::debug("LoggerPatternConverter::format() converted event is '$s'");    
-        
-    
-        if($s == null or empty($s)) {
-            if(0 < $this->min)
-                $this->spacePad($sbuf, $this->min);
-            return;
-        }
-        
-        $len = strlen($s);
-    
-        if($len > $this->max) {
-            $sbuf .= substr($s , 0, ($len - $this->max));
-        } elseif($len < $this->min) {
-            if($this->leftAlign) {	
-                $sbuf .= $s;
-                $this->spacePad($sbuf, ($this->min - $len));
-            } else {
-                $this->spacePad($sbuf, ($this->min - $len));
-                $sbuf .= $s;
-            }
-        } else {
-            $sbuf .= $s;
-        }
-    }	
-
-
-    /**
-     * Fast space padding method.
-     *
-     * @param string    &$sbuf     string buffer
-     * @param integer   $length    pad length
-     *
-     * @todo reimplement using PHP string functions
-     */
-    function spacePad(&$sbuf, $length)
-    {
-        LoggerLog::debug("LoggerPatternConverter::spacePad() sbuf='$sbuf' len='$length'");        
-    
-        while($length >= 32) {
-          $sbuf .= $GLOBALS['log4php.LoggerPatternConverter.spaces'][5];
-          $length -= 32;
-        }
-        
-        for($i = 4; $i >= 0; $i--) {	
-            if(($length & (1<<$i)) != 0) {
-    	        $sbuf .= $GLOBALS['log4php.LoggerPatternConverter.spaces'][$i];
-            }
-        }
-
-        // $sbuf = str_pad($sbuf, $length);
-    }
+	/**
+	 * Derived pattern converters must override this method in order to
+	 * convert conversion specifiers in the correct way.
+	 *
+	 * @param LoggerLoggingEvent $event
+	 */
+	public function convert($event) {}
+
+	/**
+	 * A template method for formatting in a converter specific way.
+	 *
+	 * @param string &$sbuf string buffer
+	 * @param LoggerLoggingEvent $e
+	 */
+	public function format(&$sbuf, $e) {
+		$s = $this->convert($e);
+		
+		if($s == null or empty($s)) {
+			if(0 < $this->min) {
+				$this->spacePad($sbuf, $this->min);
+			}
+			return;
+		}
+		
+		$len = strlen($s);
+	
+		if($len > $this->max) {
+			$sbuf .= substr($s , 0, ($len - $this->max));
+		} else if($len < $this->min) {
+			if($this->leftAlign) {		
+				$sbuf .= $s;
+				$this->spacePad($sbuf, ($this->min - $len));
+			} else {
+				$this->spacePad($sbuf, ($this->min - $len));
+				$sbuf .= $s;
+			}
+		} else {
+			$sbuf .= $s;
+		}
+	}	
+
+	/**
+	 * Fast space padding method.
+	 *
+	 * @param string	$sbuf	   string buffer
+	 * @param integer	$length	   pad length
+	 *
+	 * @todo reimplement using PHP string functions
+	 */
+	public function spacePad($sbuf, $length) {
+		while($length >= 32) {
+		  $sbuf .= $GLOBALS['log4php.LoggerPatternConverter.spaces'][5];
+		  $length -= 32;
+		}
+		
+		for($i = 4; $i >= 0; $i--) {	
+			if(($length & (1<<$i)) != 0) {
+				$sbuf .= $GLOBALS['log4php.LoggerPatternConverter.spaces'][$i];
+			}
+		}
+
+		// $sbuf = str_pad($sbuf, $length);
+	}
 }
 
 // ---------------------------------------------------------------------
@@ -501,4 +493,4 @@ class LoggerCategoryPatternConverter extends LoggerNamedPatternConverter {
     }
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/helpers/LoggerPatternParser.php b/libraries/log4php.debug/helpers/LoggerPatternParser.php
index 307fbd712..db3f72354 100644
--- a/libraries/log4php.debug/helpers/LoggerPatternParser.php
+++ b/libraries/log4php.debug/helpers/LoggerPatternParser.php
@@ -1,20 +1,21 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *	   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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage helpers
  */
 
 /**
@@ -40,33 +41,6 @@ if (!defined('LOG4PHP_LINE_SEP')) {
  */
 require_once(LOG4PHP_DIR . '/helpers/LoggerFormattingInfo.php');
 require_once(LOG4PHP_DIR . '/helpers/LoggerPatternConverter.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
-define('LOG4PHP_LOGGER_PATTERN_PARSER_ESCAPE_CHAR',         '%');
-
-define('LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE',       0);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE',     1);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_MINUS_STATE',         2);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE',           3);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE',           4);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE',           5);
-
-define('LOG4PHP_LOGGER_PATTERN_PARSER_FULL_LOCATION_CONVERTER',         1000);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_METHOD_LOCATION_CONVERTER',       1001);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_CLASS_LOCATION_CONVERTER',        1002);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_FILE_LOCATION_CONVERTER',         1003);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_LINE_LOCATION_CONVERTER',         1004);
-
-define('LOG4PHP_LOGGER_PATTERN_PARSER_RELATIVE_TIME_CONVERTER',         2000);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_THREAD_CONVERTER',                2001);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_LEVEL_CONVERTER',                 2002);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_NDC_CONVERTER',                   2003);
-define('LOG4PHP_LOGGER_PATTERN_PARSER_MESSAGE_CONVERTER',               2004);
-
-define('LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601',    'Y-m-d H:i:s,u'); 
-define('LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ABSOLUTE',   'H:i:s');
-define('LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_DATE',       'd M Y H:i:s,u');
-
 /**
  * Most of the work of the {@link LoggerPatternLayout} class 
  * is delegated to the {@link LoggerPatternParser} class.
@@ -74,8 +48,7 @@ define('LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_DATE',       'd M Y H:i:s,u');
  * <p>It is this class that parses conversion patterns and creates
  * a chained list of {@link LoggerPatternConverter} converters.</p>
  * 
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.10 $ 
+ * @version $Revision: 822445 $ 
  * @package log4php
  * @subpackage helpers
  *
@@ -83,337 +56,310 @@ define('LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_DATE',       'd M Y H:i:s,u');
  */
 class LoggerPatternParser {
 
-    var $state;
-    var $currentLiteral;
-    var $patternLength;
-    var $i;
-    
-    /**
-     * @var LoggerPatternConverter
-     */
-    var $head = null;
-     
-    /**
-     * @var LoggerPatternConverter
-     */
-    var $tail = null;
-    
-    /**
-     * @var LoggerFormattingInfo
-     */
-    var $formattingInfo;
-    
-    /**
-     * @var string pattern to parse
-     */
-    var $pattern;
+	const ESCAPE_CHAR = '%';
+	
+	const LITERAL_STATE = 0;
+	const CONVERTER_STATE = 1;
+	const MINUS_STATE = 2;
+	const DOT_STATE = 3;
+	const MIN_STATE = 4;
+	const MAX_STATE = 5;
+	
+	const FULL_LOCATION_CONVERTER = 1000;
+	const METHOD_LOCATION_CONVERTER = 1001;
+	const CLASS_LOCATION_CONVERTER = 1002;
+	const FILE_LOCATION_CONVERTER = 1003;
+	const LINE_LOCATION_CONVERTER = 1004;
+	
+	const RELATIVE_TIME_CONVERTER = 2000;
+	const THREAD_CONVERTER = 2001;
+	const LEVEL_CONVERTER = 2002;
+	const NDC_CONVERTER = 2003;
+	const MESSAGE_CONVERTER = 2004;
+	
+	const DATE_FORMAT_ISO8601 = 'Y-m-d H:i:s,u'; 
+	const DATE_FORMAT_ABSOLUTE = 'H:i:s';
+	const DATE_FORMAT_DATE = 'd M Y H:i:s,u';
 
-    /**
-     * Constructor 
-     *
-     * @param string $pattern
-     */
-    function LoggerPatternParser($pattern)
-    {
-        LoggerLog::debug("LoggerPatternParser::LoggerPatternParser() pattern='$pattern'");
-    
-        $this->pattern = $pattern;
-        $this->patternLength =  strlen($pattern);
-        $this->formattingInfo = new LoggerFormattingInfo();
-        $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
-    }
+	private $state;
+	private $currentLiteral;
+	private $patternLength;
+	private $i;
+	
+	/**
+	 * @var LoggerPatternConverter
+	 */
+	private $head = null;
+	 
+	/**
+	 * @var LoggerPatternConverter
+	 */
+	private $tail = null;
+	
+	/**
+	 * @var LoggerFormattingInfo
+	 */
+	private $formattingInfo;
+	
+	/**
+	 * @var string pattern to parse
+	 */
+	private $pattern;
 
-    /**
-     * @param LoggerPatternConverter $pc
-     */
-    function addToList($pc)
-    {
-        // LoggerLog::debug("LoggerPatternParser::addToList()");
-    
-        if($this->head == null) {
-            $this->head = $pc;
-            $this->tail =& $this->head;
-        } else {
-            $this->tail->next = $pc;
-            $this->tail =& $this->tail->next;
-        }
-    }
+	/**
+	 * Constructor 
+	 *
+	 * @param string $pattern
+	 */
+	public function __construct($pattern) {
+		$this->pattern = $pattern;
+		$this->patternLength =	strlen($pattern);
+		$this->formattingInfo = new LoggerFormattingInfo();
+		$this->state = self::LITERAL_STATE;
+	}
 
-    /**
-     * @return string
-     */
-    function extractOption()
-    {
-        if(($this->i < $this->patternLength) and ($this->pattern{$this->i} == '{')) {
-            $end = strpos($this->pattern, '}' , $this->i);
-            if ($end !== false) {
-                $r = substr($this->pattern, ($this->i + 1), ($end - $this->i - 1));
-	            $this->i= $end + 1;
-        	    return $r;
-            }
-        }
-        return null;
-    }
+	/**
+	 * @param LoggerPatternConverter $pc
+	 */
+	public function addToList($pc) {
+		if($this->head == null) {
+			$this->head = $pc;
+			$this->tail = $this->head;
+		} else {
+			$this->tail->next = $pc;
+			$this->tail = $this->tail->next;
+		}
+	}
 
-    /**
-     * The option is expected to be in decimal and positive. In case of
-     * error, zero is returned.  
-     */
-    function extractPrecisionOption()
-    {
-        $opt = $this->extractOption();
-        $r = 0;
-        if ($opt !== null) {
-            if (is_numeric($opt)) {
-    	        $r = (int)$opt;
-            	if($r <= 0) {
-            	    LoggerLog::warn("Precision option ({$opt}) isn't a positive integer.");
-            	    $r = 0;
-            	}
-            } else {
-                LoggerLog::warn("Category option \"{$opt}\" not a decimal integer.");
-            }
-        }
-        return $r;
-    }
+	/**
+	 * @return string
+	 */
+	public function extractOption() {
+		if(($this->i < $this->patternLength) and ($this->pattern{$this->i} == '{')) {
+			$end = strpos($this->pattern, '}' , $this->i);
+			if($end !== false) {
+				$r = substr($this->pattern, ($this->i + 1), ($end - $this->i - 1));
+				$this->i= $end + 1;
+				return $r;
+			}
+		}
+		return null;
+	}
 
-    function parse()
-    {
-        LoggerLog::debug("LoggerPatternParser::parse()");
-    
-        $c = '';
-        $this->i = 0;
-        $this->currentLiteral = '';
-        while ($this->i < $this->patternLength) {
-            $c = $this->pattern{$this->i++};
-//            LoggerLog::debug("LoggerPatternParser::parse() char is now '$c' and currentLiteral is '{$this->currentLiteral}'");            
-            switch($this->state) {
-                case LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE:
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE'");
-                    // In literal state, the last char is always a literal.
-                    if($this->i == $this->patternLength) {
-                        $this->currentLiteral .= $c;
-                        continue;
-                    }
-                    if($c == LOG4PHP_LOGGER_PATTERN_PARSER_ESCAPE_CHAR) {
-                        // LoggerLog::debug("LoggerPatternParser::parse() char is an escape char");                    
-                        // peek at the next char.
-                        switch($this->pattern{$this->i}) {
-                            case LOG4PHP_LOGGER_PATTERN_PARSER_ESCAPE_CHAR:
-                                // LoggerLog::debug("LoggerPatternParser::parse() next char is an escape char");                    
-                                $this->currentLiteral .= $c;
-                                $this->i++; // move pointer
-                                break;
-                            case 'n':
-                                // LoggerLog::debug("LoggerPatternParser::parse() next char is 'n'");                            
-                                $this->currentLiteral .= LOG4PHP_LINE_SEP;
-                                $this->i++; // move pointer
-                                break;
-                            default:
-                                if(strlen($this->currentLiteral) != 0) {
-                                    $this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
-                                    LoggerLog::debug("LoggerPatternParser::parse() Parsed LITERAL converter: \"{$this->currentLiteral}\".");
-                                }
-                                $this->currentLiteral = $c;
-                                $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE;
-                                $this->formattingInfo->reset();
-                        }
-                    } else {
-                        $this->currentLiteral .= $c;
-                    }
-                    break;
-              case LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE:
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_CONVERTER_STATE'");              
-                	$this->currentLiteral .= $c;
-                	switch($c) {
-                    	case '-':
-                            $this->formattingInfo->leftAlign = true;
-                            break;
-                    	case '.':
-                            $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE;
-	                        break;
-                    	default:
-                            if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
-                        	    $this->formattingInfo->min = ord($c) - ord('0');
-                        	    $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE;
-                            } else {
-                                $this->finalizeConverter($c);
-                            }
-                  	} // switch
-                    break;
-              case LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE:
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_MIN_STATE'");              
-	                $this->currentLiteral .= $c;
-                    if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
-                        $this->formattingInfo->min = ($this->formattingInfo->min * 10) + (ord(c) - ord('0'));
-                	} elseif ($c == '.') {
-                        $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE;
-                    } else {
-                    	$this->finalizeConverter($c);
-                	}
-                	break;
-              case LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE:
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_DOT_STATE'");              
-                	$this->currentLiteral .= $c;
-                    if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
-                        $this->formattingInfo->max = ord($c) - ord('0');
-	                    $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE;
-                    } else {
-                	  LoggerLog::warn("LoggerPatternParser::parse() Error occured in position {$this->i}. Was expecting digit, instead got char \"{$c}\".");
-	                  $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
-                    }
-                	break;
-              case LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE:
-                    // LoggerLog::debug("LoggerPatternParser::parse() state is 'LOG4PHP_LOGGER_PATTERN_PARSER_MAX_STATE'");              
-                	$this->currentLiteral .= $c;
-                    if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
-                        $this->formattingInfo->max = ($this->formattingInfo->max * 10) + (ord($c) - ord('0'));
-	                } else {
-                	  $this->finalizeConverter($c);
-                      $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
-	                }
-                	break;
-            } // switch
-        } // while
-        if(strlen($this->currentLiteral) != 0) {
-            $this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
-            // LoggerLog::debug("LoggerPatternParser::parse() Parsed LITERAL converter: \"{$this->currentLiteral}\".");
-        }
-        return $this->head;
-    }
+	/**
+	 * The option is expected to be in decimal and positive. In case of
+	 * error, zero is returned.	 
+	 */
+	public function extractPrecisionOption() {
+		$opt = $this->extractOption();
+		$r = 0;
+		if($opt !== null) {
+			if(is_numeric($opt)) {
+				$r = (int)$opt;
+				if($r <= 0) {
+					$r = 0;
+				}
+			}
+		}
+		return $r;
+	}
 
-    function finalizeConverter($c)
-    {
-        LoggerLog::debug("LoggerPatternParser::finalizeConverter() with char '$c'");    
+	
+	/** Parser.
+	 * 
+	 * @return LoggerPatternConverter Returns $this->head.
+	 */
+	public function parse() {
+		$c = '';
+		$this->i = 0;
+		$this->currentLiteral = '';
+		while($this->i < $this->patternLength) {
+			$c = $this->pattern{$this->i++};
 
-        $pc = null;
-        switch($c) {
-            case 'c':
-                $pc = new LoggerCategoryPatternConverter($this->formattingInfo, $this->extractPrecisionOption());
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() CATEGORY converter.");
-                // $this->formattingInfo->dump();
-                $this->currentLiteral = '';
-                break;
-            case 'C':
-                $pc = new LoggerClassNamePatternConverter($this->formattingInfo, $this->extractPrecisionOption());
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() CLASSNAME converter.");
-                //$this->formattingInfo->dump();
-                $this->currentLiteral = '';
-                break;
-            case 'd':
-                $dateFormatStr = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601; // ISO8601_DATE_FORMAT;
-                $dOpt = $this->extractOption();
+			switch($this->state) {
+				case self::LITERAL_STATE:
+					// In literal state, the last char is always a literal.
+					if($this->i == $this->patternLength) {
+						$this->currentLiteral .= $c;
+						continue;
+					}
+					if($c == self::ESCAPE_CHAR) {
+						// peek at the next char.
+						switch($this->pattern{$this->i}) {
+							case self::ESCAPE_CHAR:
+								$this->currentLiteral .= $c;
+								$this->i++; // move pointer
+								break;
+							case 'n':
+								$this->currentLiteral .= PHP_EOL;
+								$this->i++; // move pointer
+								break;
+							default:
+								if(strlen($this->currentLiteral) != 0) {
+									$this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
+								}
+								$this->currentLiteral = $c;
+								$this->state = self::CONVERTER_STATE;
+								$this->formattingInfo->reset();
+						}
+					} else {
+						$this->currentLiteral .= $c;
+					}
+					break;
+				case self::CONVERTER_STATE:
+						$this->currentLiteral .= $c;
+						switch($c) {
+						case '-':
+							$this->formattingInfo->leftAlign = true;
+							break;
+						case '.':
+							$this->state = self::DOT_STATE;
+								break;
+						default:
+							if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
+								$this->formattingInfo->min = ord($c) - ord('0');
+								$this->state = self::MIN_STATE;
+							} else {
+								$this->finalizeConverter($c);
+							}
+						} // switch
+					break;
+				case self::MIN_STATE:
+					$this->currentLiteral .= $c;
+					if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
+						$this->formattingInfo->min = ($this->formattingInfo->min * 10) + (ord($c) - ord('0'));
+					} else if ($c == '.') {
+						$this->state = self::DOT_STATE;
+					} else {
+						$this->finalizeConverter($c);
+					}
+					break;
+				case self::DOT_STATE:
+					$this->currentLiteral .= $c;
+					if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
+						$this->formattingInfo->max = ord($c) - ord('0');
+						$this->state = self::MAX_STATE;
+					} else {
+						$this->state = self::LITERAL_STATE;
+					}
+					break;
+				case self::MAX_STATE:
+					$this->currentLiteral .= $c;
+					if(ord($c) >= ord('0') and ord($c) <= ord('9')) {
+						$this->formattingInfo->max = ($this->formattingInfo->max * 10) + (ord($c) - ord('0'));
+					} else {
+						$this->finalizeConverter($c);
+						$this->state = self::LITERAL_STATE;
+					}
+					break;
+			} // switch
+		} // while
+		if(strlen($this->currentLiteral) != 0) {
+			$this->addToList(new LoggerLiteralPatternConverter($this->currentLiteral));
+		}
+		return $this->head;
+	}
 
-                if($dOpt !== null)
-	                $dateFormatStr = $dOpt;
-                    
-                if ($dateFormatStr == 'ISO8601') {
-                    $df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601;
-                } elseif($dateFormatStr == 'ABSOLUTE') {
-                    $df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ABSOLUTE;
-                } elseif($dateFormatStr == 'DATE') {
-                    $df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_DATE;
-                } else {
-                    $df = $dateFormatStr;
-                    if ($df == null) {
-                        $df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601;
-                    }
-	            }
-                $pc = new LoggerDatePatternConverter($this->formattingInfo, $df);
-                $this->currentLiteral = '';
-                break;
-            case 'F':
-                $pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_FILE_LOCATION_CONVERTER);
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() File name converter.");
-                //formattingInfo.dump();
-                $this->currentLiteral = '';
-                break;
-            case 'l':
-                $pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_FULL_LOCATION_CONVERTER);
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() Location converter.");
-                //formattingInfo.dump();
-                $this->currentLiteral = '';
-                break;
-            case 'L':
-                $pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_LINE_LOCATION_CONVERTER);
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() LINE NUMBER converter.");
-                //formattingInfo.dump();
-                $this->currentLiteral = '';
-                break;
-            case 'm':
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_MESSAGE_CONVERTER);
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() MESSAGE converter.");
-                //formattingInfo.dump();
-                $this->currentLiteral = '';
-                break;
-            case 'M':
-                $pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_METHOD_LOCATION_CONVERTER);
-                //LogLog.debug("METHOD converter.");
-                //formattingInfo.dump();
-                $this->currentLiteral = '';
-                break;
-            case 'p':
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_LEVEL_CONVERTER);
-                //LogLog.debug("LEVEL converter.");
-                //formattingInfo.dump();
-                $this->currentLiteral = '';
-                break;
-            case 'r':
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_RELATIVE_TIME_CONVERTER);
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() RELATIVE TIME converter.");
-                //formattingInfo.dump();
-                $this->currentLiteral = '';
-                break;
-            case 't':
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_THREAD_CONVERTER);
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() THREAD converter.");
-                //formattingInfo.dump();
-                $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')));
-                        LoggerLog::debug("LoggerPatternParser::finalizeConverter() USER converter [{$cNext}].");
-	                    // formattingInfo.dump();
-                        $this->currentLiteral = '';
-	                    $this->i++;
-	                } else {
-                        LoggerLog::warn("LoggerPatternParser::finalizeConverter() Unexpected char '{$cNext}' at position {$this->i}.");
-                    }
-                }
-                break;
-            case 'x':
-                $pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_NDC_CONVERTER);
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() NDC converter.");
-                $this->currentLiteral = '';
-                break;
+	public function finalizeConverter($c) {
+		$pc = null;
+		switch($c) {
+			case 'c':
+				$pc = new LoggerCategoryPatternConverter($this->formattingInfo, $this->extractPrecisionOption());
+				$this->currentLiteral = '';
+				break;
+			case 'C':
+				$pc = new LoggerClassNamePatternConverter($this->formattingInfo, $this->extractPrecisionOption());
+				$this->currentLiteral = '';
+				break;
+			case 'd':
+				$dateFormatStr = self::DATE_FORMAT_ISO8601; // ISO8601_DATE_FORMAT;
+				$dOpt = $this->extractOption();
 
-            case 'X':
-                $xOpt = $this->extractOption();
-                $pc = new LoggerMDCPatternConverter($this->formattingInfo, $xOpt);
-                LoggerLog::debug("LoggerPatternParser::finalizeConverter() MDC converter.");
-                $this->currentLiteral = '';
-                break;
-            default:
-                LoggerLog::warn("LoggerPatternParser::finalizeConverter() Unexpected char [$c] at position {$this->i} in conversion pattern.");
-                $pc = new LoggerLiteralPatternConverter($this->currentLiteral);
-                $this->currentLiteral = '';
-        }
-        $this->addConverter($pc);
-    }
+				if($dOpt !== null)
+					$dateFormatStr = $dOpt;
+					
+				if($dateFormatStr == 'ISO8601') {
+					$df = self::DATE_FORMAT_ISO8601;
+				} else if($dateFormatStr == 'ABSOLUTE') {
+					$df = self::DATE_FORMAT_ABSOLUTE;
+				} else if($dateFormatStr == 'DATE') {
+					$df = self::DATE_FORMAT_DATE;
+				} else {
+					$df = $dateFormatStr;
+					if($df == null) {
+						$df = self::DATE_FORMAT_ISO8601;
+					}
+				}
+				$pc = new LoggerDatePatternConverter($this->formattingInfo, $df);
+				$this->currentLiteral = '';
+				break;
+			case 'F':
+				$pc = new LoggerLocationPatternConverter($this->formattingInfo, self::FILE_LOCATION_CONVERTER);
+				$this->currentLiteral = '';
+				break;
+			case 'l':
+				$pc = new LoggerLocationPatternConverter($this->formattingInfo, self::FULL_LOCATION_CONVERTER);
+				$this->currentLiteral = '';
+				break;
+			case 'L':
+				$pc = new LoggerLocationPatternConverter($this->formattingInfo, self::LINE_LOCATION_CONVERTER);
+				$this->currentLiteral = '';
+				break;
+			case 'm':
+				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::MESSAGE_CONVERTER);
+				$this->currentLiteral = '';
+				break;
+			case 'M':
+				$pc = new LoggerLocationPatternConverter($this->formattingInfo, self::METHOD_LOCATION_CONVERTER);
+				$this->currentLiteral = '';
+				break;
+			case 'p':
+				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::LEVEL_CONVERTER);
+				$this->currentLiteral = '';
+				break;
+			case 'r':
+				$pc = new LoggerBasicPatternConverter($this->formattingInfo, self::RELATIVE_TIME_CONVERTER);
+				$this->currentLiteral = '';
+				break;
+			case 't':
+				$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 = '';
+				break;
+			case 'X':
+				$xOpt = $this->extractOption();
+				$pc = new LoggerMDCPatternConverter($this->formattingInfo, $xOpt);
+				$this->currentLiteral = '';
+				break;
+			default:
+				$pc = new LoggerLiteralPatternConverter($this->currentLiteral);
+				$this->currentLiteral = '';
+		}
+		$this->addConverter($pc);
+	}
 
-    function addConverter($pc)
-    {
-        $this->currentLiteral = '';
-        // Add the pattern converter to the list.
-        $this->addToList($pc);
-        // Next pattern is assumed to be a literal.
-        $this->state = LOG4PHP_LOGGER_PATTERN_PARSER_LITERAL_STATE;
-        // Reset formatting info
-        $this->formattingInfo->reset();
-    }
+	public function addConverter($pc) {
+		$this->currentLiteral = '';
+		// Add the pattern converter to the list.
+		$this->addToList($pc);
+		// Next pattern is assumed to be a literal.
+		$this->state = self::LITERAL_STATE;
+		// Reset formatting info
+		$this->formattingInfo->reset();
+	}
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/helpers/LoggerTransform.php b/libraries/log4php.debug/helpers/LoggerTransform.php
deleted file mode 100644
index 6aef42d7e..000000000
--- a/libraries/log4php.debug/helpers/LoggerTransform.php
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage helpers
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-define('LOG4PHP_LOGGER_TRANSFORM_CDATA_START',          '<![CDATA[');
-define('LOG4PHP_LOGGER_TRANSFORM_CDATA_END',            ']]>');
-define('LOG4PHP_LOGGER_TRANSFORM_CDATA_PSEUDO_END',     ']]&gt;');
-define('LOG4PHP_LOGGER_TRANSFORM_CDATA_EMBEDDED_END',   
-    LOG4PHP_LOGGER_TRANSFORM_CDATA_END .
-    LOG4PHP_LOGGER_TRANSFORM_CDATA_PSEUDO_END .
-    LOG4PHP_LOGGER_TRANSFORM_CDATA_START 
-);
-
-/**
- * Utility class for transforming strings.
- *
- * @log4j-class org.apache.log4j.helpers.Transform
- *
- * @author VxR <vxr@vxr.it>
- * @package log4php
- * @subpackage helpers
- * @since 0.7
- */
-class LoggerTransform {
-
-    /**
-    * This method takes a string which may contain HTML tags (ie,
-    * &lt;b&gt;, &lt;table&gt;, etc) and replaces any '&lt;' and '&gt;'
-    * characters with respective predefined entity references.
-    *
-    * @param string $input The text to be converted.
-    * @return string The input string with the characters '&lt;' and '&gt;' replaced with
-    *                &amp;lt; and &amp;gt; respectively.
-    * @static  
-    */
-    function escapeTags($input)
-    {
-        //Check if the string is null or zero length -- if so, return
-        //what was sent in.
-
-        if(empty($input))
-            return $input;
-
-        //Use a StringBuffer in lieu of String concatenation -- it is
-        //much more efficient this way.
-
-        return htmlspecialchars($input, ENT_NOQUOTES);
-    }
-
-    /**
-    * 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  
-    */
-    function appendEscapingCDATA(&$buf, $str)
-    {
-        if(empty($str))
-            return;
-    
-        $rStr = str_replace(
-            LOG4PHP_LOGGER_TRANSFORM_CDATA_END,
-            LOG4PHP_LOGGER_TRANSFORM_CDATA_EMBEDDED_END,
-            $str
-        );
-        $buf .= $rStr;
-    }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutHtml.php b/libraries/log4php.debug/layouts/LoggerLayoutHtml.php
index 1c3410b67..eeda02663 100644
--- a/libraries/log4php.debug/layouts/LoggerLayoutHtml.php
+++ b/libraries/log4php.debug/layouts/LoggerLayoutHtml.php
@@ -1,53 +1,58 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *     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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage layouts
  */
 
 /**
  * @ignore 
  */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
-
-if (!defined('LOG4PHP_LINE_SEP')) {
-    if (substr(php_uname(), 0, 7) == "Windows") { 
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\r\n");
-    } else {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\n");
-    }
-}
  
 /**
  */
 require_once(LOG4PHP_DIR . '/LoggerLayout.php');
-require_once(LOG4PHP_DIR . '/spi/LoggerLoggingEvent.php');
+require_once(LOG4PHP_DIR . '/LoggerLoggingEvent.php');
 
 /**
  * This layout outputs events in a HTML table.
  *
- * Parameters are: {@link $title}, {@link $locationInfo}.
+ * Configurable parameters for this layout are:
+ * 
+ * - title
+ * - locationInfo
+ *
+ * An example for this layout:
+ * 
+ * {@example ../../examples/php/layout_html.php 19}<br>
+ * 
+ * The corresponding XML file:
+ * 
+ * {@example ../../examples/resources/layout_html.properties 18}
+ * 
+ * The above will print a HTML table that looks, converted back to plain text, like the following:<br>
+ * <pre>
+ *    Log session start time Wed Sep 9 00:11:30 2009
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.14 $
+ *    Time Thread Level Category   Message
+ *    0    8318   INFO  root       Hello World!
+ * </pre>
+ * 
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage layouts
  */
@@ -65,7 +70,7 @@ class LoggerLayoutHtml extends LoggerLayout {
      * <b>LocationInfo</b> option of that appender as well.
      * @var boolean
      */
-    var $locationInfo = false;
+    private $locationInfo = false;
     
     /**
      * The <b>Title</b> option takes a String value. This option sets the
@@ -73,14 +78,12 @@ class LoggerLayoutHtml extends LoggerLayout {
      * Defaults to 'Log4php Log Messages'.
      * @var string
      */
-    var $title = "Log4php Log Messages";
+    private $title = "Log4php Log Messages";
     
     /**
      * Constructor
      */
-    function LoggerLayoutHtml()
-    {
-        return;
+    public function __construct() {
     }
     
     /**
@@ -94,8 +97,7 @@ class LoggerLayoutHtml extends LoggerLayout {
      * or a {@link LoggerAppenderMailEvent} then make sure to set the
      * <b>LocationInfo</b> option of that appender as well.
      */
-    function setLocationInfo($flag)
-    {
+    public function setLocationInfo($flag) {
         if (is_bool($flag)) {
             $this->locationInfo = $flag;
         } else {
@@ -106,8 +108,7 @@ class LoggerLayoutHtml extends LoggerLayout {
     /**
      * Returns the current value of the <b>LocationInfo</b> option.
      */
-    function getLocationInfo()
-    {
+    public function getLocationInfo() {
         return $this->locationInfo;
     }
     
@@ -116,53 +117,38 @@ class LoggerLayoutHtml extends LoggerLayout {
      * document title of the generated HTML document.
      * Defaults to 'Log4php Log Messages'.
      */
-    function setTitle($title)
-    {
+    public function setTitle($title) {
         $this->title = $title;
     }
 
     /**
      * @return string Returns the current value of the <b>Title</b> option.
      */
-    function getTitle()
-    {
+    public function getTitle() {
         return $this->title;
     }
     
     /**
      * @return string Returns the content type output by this layout, i.e "text/html".
      */
-    function getContentType()
-    {
+    public function getContentType() {
         return "text/html";
     }
     
-    /**
-     * No options to activate.
-     */
-    function activateOptions()
-    {
-        return true;
-    }
-    
     /**
      * @param LoggerLoggingEvent $event
      * @return string
      */
-    function format($event)
-    {
-        $sbuf = LOG4PHP_LINE_SEP . "<tr>" . LOG4PHP_LINE_SEP;
+    public function format(LoggerLoggingEvent $event) {
+        $sbuf = PHP_EOL . "<tr>" . PHP_EOL;
     
         $sbuf .= "<td>";
-        
-        $eventTime = (float)$event->getTimeStamp();
-        $eventStartTime = (float)LoggerLoggingEvent::getStartTime();
-        $sbuf .= number_format(($eventTime - $eventStartTime) * 1000, 0, '', '');
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= $event->getTime();
+        $sbuf .= "</td>" . PHP_EOL;
     
         $sbuf .= "<td title=\"" . $event->getThreadName() . " thread\">";
         $sbuf .= $event->getThreadName();
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</td>" . PHP_EOL;
     
         $sbuf .= "<td title=\"Level\">";
         
@@ -172,71 +158,69 @@ class LoggerLayoutHtml extends LoggerLayout {
           $sbuf .= "<font color=\"#339933\">";
           $sbuf .= $level->toString();
           $sbuf .= "</font>";
-        }elseif($level->equals(LoggerLevel::getLevelWarn())) {
+        } else if ($level->equals(LoggerLevel::getLevelWarn())) {
           $sbuf .= "<font color=\"#993300\"><strong>";
           $sbuf .= $level->toString();
           $sbuf .= "</strong></font>";
         } else {
           $sbuf .= $level->toString();
         }
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</td>" . PHP_EOL;
     
         $sbuf .= "<td title=\"" . htmlentities($event->getLoggerName(), ENT_QUOTES) . " category\">";
         $sbuf .= htmlentities($event->getLoggerName(), ENT_QUOTES);
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</td>" . PHP_EOL;
     
         if ($this->locationInfo) {
             $locInfo = $event->getLocationInformation();
             $sbuf .= "<td>";
             $sbuf .= htmlentities($locInfo->getFileName(), ENT_QUOTES). ':' . $locInfo->getLineNumber();
-            $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+            $sbuf .= "</td>" . PHP_EOL;
         }
 
         $sbuf .= "<td title=\"Message\">";
         $sbuf .= htmlentities($event->getRenderedMessage(), ENT_QUOTES);
-        $sbuf .= "</td>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</td>" . PHP_EOL;
 
-        $sbuf .= "</tr>" . LOG4PHP_LINE_SEP;
+        $sbuf .= "</tr>" . PHP_EOL;
         
         if ($event->getNDC() != null) {
             $sbuf .= "<tr><td bgcolor=\"#EEEEEE\" style=\"font-size : xx-small;\" colspan=\"6\" title=\"Nested Diagnostic Context\">";
             $sbuf .= "NDC: " . htmlentities($event->getNDC(), ENT_QUOTES);
-            $sbuf .= "</td></tr>" . LOG4PHP_LINE_SEP;
+            $sbuf .= "</td></tr>" . PHP_EOL;
         }
-
         return $sbuf;
     }
 
     /**
      * @return string Returns appropriate HTML headers.
      */
-    function getHeader()
-    {
-        $sbuf = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<html>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<head>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<title>" . $this->title . "</title>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<style type=\"text/css\">" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<!--" . LOG4PHP_LINE_SEP;
-        $sbuf .= "body, table {font-family: arial,sans-serif; font-size: x-small;}" . LOG4PHP_LINE_SEP;
-        $sbuf .= "th {background: #336699; color: #FFFFFF; text-align: left;}" . LOG4PHP_LINE_SEP;
-        $sbuf .= "-->" . LOG4PHP_LINE_SEP;
-        $sbuf .= "</style>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "</head>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<hr size=\"1\" noshade>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "Log session start time " . strftime('%c', time()) . "<br>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<br>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" bordercolor=\"#224466\" width=\"100%\">" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<tr>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Time</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Thread</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Level</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Category</th>" . LOG4PHP_LINE_SEP;
+    public function getHeader() {
+        $sbuf = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">" . PHP_EOL;
+        $sbuf .= "<html>" . PHP_EOL;
+        $sbuf .= "<head>" . PHP_EOL;
+        $sbuf .= "<title>" . $this->title . "</title>" . PHP_EOL;
+        $sbuf .= "<style type=\"text/css\">" . PHP_EOL;
+        $sbuf .= "<!--" . PHP_EOL;
+        $sbuf .= "body, table {font-family: arial,sans-serif; font-size: x-small;}" . PHP_EOL;
+        $sbuf .= "th {background: #336699; color: #FFFFFF; text-align: left;}" . PHP_EOL;
+        $sbuf .= "-->" . PHP_EOL;
+        $sbuf .= "</style>" . PHP_EOL;
+        $sbuf .= "</head>" . PHP_EOL;
+        $sbuf .= "<body bgcolor=\"#FFFFFF\" topmargin=\"6\" leftmargin=\"6\">" . PHP_EOL;
+        $sbuf .= "<hr size=\"1\" noshade>" . PHP_EOL;
+        $sbuf .= "Log session start time " . strftime('%c', time()) . "<br>" . PHP_EOL;
+        $sbuf .= "<br>" . PHP_EOL;
+        $sbuf .= "<table cellspacing=\"0\" cellpadding=\"4\" border=\"1\" bordercolor=\"#224466\" width=\"100%\">" . PHP_EOL;
+        $sbuf .= "<tr>" . PHP_EOL;
+        $sbuf .= "<th>Time</th>" . PHP_EOL;
+        $sbuf .= "<th>Thread</th>" . PHP_EOL;
+        $sbuf .= "<th>Level</th>" . PHP_EOL;
+        $sbuf .= "<th>Category</th>" . PHP_EOL;
         if ($this->locationInfo)
-            $sbuf .= "<th>File:Line</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<th>Message</th>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "</tr>" . LOG4PHP_LINE_SEP;
+            $sbuf .= "<th>File:Line</th>" . PHP_EOL;
+        $sbuf .= "<th>Message</th>" . PHP_EOL;
+        $sbuf .= "</tr>" . PHP_EOL;
 
         return $sbuf;
     }
@@ -244,13 +228,12 @@ class LoggerLayoutHtml extends LoggerLayout {
     /**
      * @return string Returns the appropriate HTML footers.
      */
-    function getFooter()
-    {
-        $sbuf = "</table>" . LOG4PHP_LINE_SEP;
-        $sbuf .= "<br>" . LOG4PHP_LINE_SEP;
+    public function getFooter() {
+        $sbuf = "</table>" . PHP_EOL;
+        $sbuf .= "<br>" . PHP_EOL;
         $sbuf .= "</body></html>";
 
         return $sbuf;
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/layouts/LoggerPatternLayout.php b/libraries/log4php.debug/layouts/LoggerLayoutPattern.php
similarity index 64%
rename from libraries/log4php.debug/layouts/LoggerPatternLayout.php
rename to libraries/log4php.debug/layouts/LoggerLayoutPattern.php
index 6c21ef244..db0b2e3a8 100644
--- a/libraries/log4php.debug/layouts/LoggerPatternLayout.php
+++ b/libraries/log4php.debug/layouts/LoggerLayoutPattern.php
@@ -1,46 +1,42 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *     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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage layouts
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/helpers/LoggerPatternParser.php');
-require_once(LOG4PHP_DIR . '/LoggerLayout.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
-/**
- * Default conversion Pattern
  */
-define('LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_CONVERSION_PATTERN', '%m%n');
-
-define('LOG4PHP_LOGGER_PATTERN_LAYOUT_TTCC_CONVERSION_PATTERN',    '%r [%t] %p %c %x - %m%n');
 
 /**
  * A flexible layout configurable with pattern string.
+ *
+ * <p>Example:</p>
+ * 
+ * {@example ../../examples/php/layout_pattern.php 19}<br>
  * 
- * <p>The goal of this class is to {@link format()} a {@link LoggerLoggingEvent} and return the results as a string.
- * The results depend on the conversion pattern. 
- * The conversion pattern is closely related to the conversion pattern of the printf function in C.
+ * <p>with the following properties file:</p>
+ * 
+ * {@example ../../examples/resources/layout_pattern.properties 18}<br>
+ * 
+ * <p>would print the following:</p>
+ * 
+ * <pre>
+ * 2009-09-09 00:27:35,787 [INFO] root: Hello World! (at src/examples/php/layout_pattern.php line 6)
+ * 2009-09-09 00:27:35,787 [DEBUG] root: Second line (at src/examples/php/layout_pattern.php line 7)
+ * </pre>
+ *
+ * <p>The conversion pattern is closely related to the conversion pattern of the printf function in C.
  * A conversion pattern is composed of literal text and format control expressions called conversion specifiers.
  * You are free to insert any literal text within the conversion pattern.</p> 
  *
@@ -50,23 +46,6 @@ define('LOG4PHP_LOGGER_PATTERN_LAYOUT_TTCC_CONVERSION_PATTERN',    '%r [%t] %p %
  * <p>The conversion character specifies the type of data, e.g. category, priority, date, thread name. 
  * The format modifiers control such things as field width, padding, left and right justification.</p>
  * 
- * The following is a simple example.
- * 
- * <p>Let the conversion pattern be "%-5p [%t]: %m%n" and assume that the log4php environment 
- * was set to use a LoggerPatternLayout.</p> 
- * 
- * Then the statements
- * <code> 
- *  $root =& LoggerManager::getRoot();
- *  $root->debug("Message 1");
- *  $root->warn("Message 2");
- * </code>
- * would yield the output 
- * <pre>
- *  DEBUG [main]: Message 1
- *  WARN  [main]: Message 2
- * </pre>
- * 
  * <p>Note that there is no explicit separator between text and conversion specifiers.</p>
  * 
  * <p>The pattern parser knows when it has reached the end of a conversion specifier when it reads a conversion character. 
@@ -150,111 +129,91 @@ define('LOG4PHP_LOGGER_PATTERN_LAYOUT_TTCC_CONVERSION_PATTERN',    '%r [%t] %p %
  *                                                                However, if category name is longer than 30 chars, 
  *                                                                then truncate from the beginning.  
  * </pre>
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.7 $
+ * 
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage layouts
  * @since 0.3 
  */
-class LoggerPatternLayout extends LoggerLayout {
+class LoggerLayoutPattern extends LoggerLayout {
+	/** Default conversion Pattern */
+	const DEFAULT_CONVERSION_PATTERN = '%m%n';
 
-  /**
-   * @var string output buffer appended to when format() is invoked
-   */
-  var $sbuf;
+	/** Default conversion TTCC Pattern */
+	const TTCC_CONVERSION_PATTERN = '%r [%t] %p %c %x - %m%n';
 
-  /**
-   * @var string
-   */
-  var $pattern;
+	/** The pattern. 
+	 * @var string */
+	private $pattern;
 
-  /**
-   * @var LoggerPatternConverter head chain
-   */   
-  var $head;
+	/** Head of a chain of Converters.
+	 * @var LoggerPatternConverter */
+	private $head;
 
-  var $timezone;
+	private $timezone;
 
+	/**
+	 * Constructs a PatternLayout using the 
+	 * {@link DEFAULT_LAYOUT_PATTERN}.
+	 * The default pattern just produces the application supplied message.
+	 */
+	public function __construct($pattern = null) {
+		if ($pattern === null) {
+			$this->pattern = self :: DEFAULT_CONVERSION_PATTERN;
+		} else {
+			$this->pattern = $pattern;
+		}
+	}
+
+	/**
+	 * Set the <b>ConversionPattern</b> option. This is the string which
+	 * controls formatting and consists of a mix of literal content and
+	 * conversion specifiers.
+	 */
+	public function setConversionPattern($conversionPattern) {
+		$this->pattern = $conversionPattern;
+		$patternParser = new LoggerPatternParser($this->pattern);
+		$this->head = $patternParser->parse();
+	}
+
+	/**
+	 * Produces a formatted string as specified by the conversion pattern.
+	 *
+	 * @param LoggerLoggingEvent $event
+	 * @return string
+	 */
+	public function format(LoggerLoggingEvent $event) {
+		$sbuf = '';
+		$c = $this->head;
+		while ($c !== null) {
+			$c->format($sbuf, $event);
+			$c = $c->next;
+		}
+		return $sbuf;
+	}
+	
     /**
-     * Constructs a PatternLayout using the 
-     * {@link LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_LAYOUT_PATTERN}.
-     * The default pattern just produces the application supplied message.
-     */
-    function LoggerPatternLayout($pattern = null)
-    {
-        if ($pattern === null) {    
-            $this->LoggerPatternLayout(LOG4PHP_LOGGER_PATTERN_LAYOUT_DEFAULT_CONVERSION_PATTERN);
-        } else {
-            $this->pattern = $pattern;
-        }                
-    }
-    
-    /**
-     * Set the <b>ConversionPattern</b> option. This is the string which
-     * controls formatting and consists of a mix of literal content and
-     * conversion specifiers.
-     */
-    function setConversionPattern($conversionPattern)
-    {
-        $this->pattern = $conversionPattern;
-        $patternParser = $this->createPatternParser($this->pattern);
-        $this->head = $patternParser->parse();
-    }
-    
-    /**
-     * @return string Returns the value of the <b>ConversionPattern</b> option.
-     */
-    function getConversionPattern()
-    {
-        return $this->pattern;
-    }
-    
-    /**
-     * Does not do anything as options become effective
-     */
-    function activateOptions()
-    {
-        // nothing to do.
-    }
-    
-    function ignoresThrowable() 
-    { 
-        return true; 
-    }
-    
-    /**
-     * Returns LoggerPatternParser used to parse the conversion string. Subclasses
-     * may override this to return a subclass of PatternParser which recognize
-     * custom conversion characters.
-     *
-     * @param string $pattern
-     * @return LoggerPatternParser
-     */
-    function createPatternParser($pattern)
-    {
-        return new LoggerPatternParser($pattern);
-    }
-    
-    /**
-     * Produces a formatted string as specified by the conversion pattern.
-     *
-     * @param LoggerLoggingEvent $event
-     * @return string
+     * Returns an array with the formatted elements.
+     * 
+     * This method is mainly used for the prepared statements of {@see LoggerAppenderPDO}.
+     * 
+     * It requires {@link $this->pattern} to be a comma separated string of patterns like
+     * e.g. <code>%d,%c,%p,%m,%t,%F,%L</code>.
+     * 
+     * @return array(string)   An array of the converted elements i.e. timestamp, message, filename etc.
      */
-    function format($event)
-    {
-        LoggerLog::debug("LoggerPatternLayout::format()");    
-    
-        // Reset working stringbuffer
-        $this->sbuf = '';
+    public function formatToArray(LoggerLoggingEvent $event) {
+        $results = array();
         $c = $this->head;
-        while($c !== null) {
-            $c->format($this->sbuf, $event);
+        while ($c !== null) {
+            if ( ! $c instanceOf LoggerLiteralPatternConverter) {
+                $sbuf = null;
+                $c->format($sbuf, $event);
+                $results[] = $sbuf;
+            }
             $c = $c->next;
         }
-        return $this->sbuf;
-    }
-    
-}
-?>
\ No newline at end of file
+        return $results;
+    }      
+	
+}
\ No newline at end of file
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutSimple.php b/libraries/log4php.debug/layouts/LoggerLayoutSimple.php
index 3a479a368..3859d301d 100644
--- a/libraries/log4php.debug/layouts/LoggerLayoutSimple.php
+++ b/libraries/log4php.debug/layouts/LoggerLayoutSimple.php
@@ -1,20 +1,21 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *     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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage layouts
  */
 
 /**
@@ -22,18 +23,6 @@
  */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
 
-if (!defined('LOG4PHP_LINE_SEP')) {
-    if (substr(php_uname(), 0, 7) == "Windows") { 
-        define('LOG4PHP_LINE_SEP', "\r\n");
-    } else {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\n");
-    }
-}
-
- 
 /**
  */
 require_once(LOG4PHP_DIR . '/LoggerLayout.php');
@@ -43,27 +32,26 @@ require_once(LOG4PHP_DIR . '/LoggerLayout.php');
  *
  * Returns the log statement in a format consisting of the
  * <b>level</b>, followed by " - " and then the <b>message</b>. 
- * For example, 
- * <samp> INFO - "A message" </samp>
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.8 $
+ * For example the following php and properties files
+ * 
+ * {@example ../../examples/php/layout_simple.php 19}<br>
+ * 
+ * {@example ../../examples/resources/layout_simple.properties 18}<br>
+ *
+ * would result in:
+ * 
+ * <samp>INFO - Hello World!</samp>
+ *
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage layouts
  */  
 class LoggerLayoutSimple extends LoggerLayout {
-    
     /**
      * Constructor
      */
-    function LoggerLayoutSimple()
-    {
-        return;
-    }
-
-    function activateOptions() 
-    {
-        return;
+    public function __construct() {
     }
 
     /**
@@ -75,10 +63,9 @@ class LoggerLayoutSimple extends LoggerLayout {
      * @param LoggerLoggingEvent $event
      * @return string
      */
-    function format($event)
-    {
+    public function format(LoggerLoggingEvent $event) {
         $level = $event->getLevel();
-        return $level->toString() . ' - ' . $event->getRenderedMessage(). LOG4PHP_LINE_SEP;
+        return $level->toString() . ' - ' . $event->getRenderedMessage(). PHP_EOL;
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutTTCC.php b/libraries/log4php.debug/layouts/LoggerLayoutTTCC.php
index e90524fff..ae8028001 100644
--- a/libraries/log4php.debug/layouts/LoggerLayoutTTCC.php
+++ b/libraries/log4php.debug/layouts/LoggerLayoutTTCC.php
@@ -1,60 +1,31 @@
 <?php
 /**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
+ * 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
  *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
+ *     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.
  *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
  * @package log4php
- * @subpackage layouts
  */
 
-/**
- * @ignore 
- */
 if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
 
-if (!defined('LOG4PHP_LINE_SEP')) {
-    if (substr(php_uname(), 0, 7) == "Windows") { 
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\r\n");
-    } else {
-        /**
-         * @ignore
-         */
-        define('LOG4PHP_LINE_SEP', "\n");
-    }
-}
- 
 /**
  */
 require_once(LOG4PHP_DIR . '/LoggerLayout.php');
- 
-/**
- * String constant designating no time information. Current value of
- * this constant is <b>NULL</b>.
- */
-define ('LOG4PHP_LOGGER_LAYOUT_NULL_DATE_FORMAT',   'NULL');
-
 /**
- * String constant designating relative time. Current value of
- * this constant is <b>RELATIVE</b>.
- */
-define ('LOG4PHP_LOGGER_LAYOUT_RELATIVE_TIME_DATE_FORMAT', 'RELATIVE');
-
-/**
- * TTCC layout format consists of time, thread, category and nested
- * diagnostic context information, hence the name.
+ * TTCC layout format consists of <b>t</b>ime, <b>t</b>hread, <b>c</b>ategory and nested
+ * diagnostic <b>c</b>ontext information, hence the name.
  * 
  * <p>Each of the four fields can be individually enabled or
  * disabled. The time format depends on the <b>DateFormat</b> used.</p>
@@ -62,30 +33,52 @@ define ('LOG4PHP_LOGGER_LAYOUT_RELATIVE_TIME_DATE_FORMAT', 'RELATIVE');
  * <p>If no dateFormat is specified it defaults to '%c'. 
  * See php {@link PHP_MANUAL#date} function for details.</p>
  *
- * Params:
+ * Configurable parameters for this layout are:
  * - {@link $threadPrinting} (true|false) enable/disable pid reporting.
  * - {@link $categoryPrefixing} (true|false) enable/disable logger category reporting.
  * - {@link $contextPrinting} (true|false) enable/disable NDC reporting.
  * - {@link $microSecondsPrinting} (true|false) enable/disable micro seconds reporting in timestamp.
  * - {@link $dateFormat} (string) set date format. See php {@link PHP_MANUAL#date} function for details.
  *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.12 $
+ * An example how to use this layout:
+ * 
+ * {@example ../../examples/php/layout_ttcc.php 19}<br>
+ * 
+ * {@example ../../examples/resources/layout_ttcc.properties 18}<br>
+ *
+ * The above would print:<br>
+ * <samp>02:28 [13714] INFO root - Hello World!</samp>
+ *
+ * @version $Revision: 883108 $
  * @package log4php
  * @subpackage layouts
  */
 class LoggerLayoutTTCC extends LoggerLayout {
 
+	/**
+	 * String constant designating no time information. Current value of
+	 * this constant is <b>NULL</b>.
+	 */
+	 // TODO: not used?
+	const LOG4PHP_LOGGER_LAYOUT_NULL_DATE_FORMAT = 'NULL';
+	
+	/**
+	 * String constant designating relative time. Current value of
+	 * this constant is <b>RELATIVE</b>.
+	 */
+	 // TODO: not used?
+	const LOG4PHP_LOGGER_LAYOUT_RELATIVE_TIME_DATE_FORMAT = 'RELATIVE';
+	
     // Internal representation of options
-    var $threadPrinting    = true;
-    var $categoryPrefixing = true;
-    var $contextPrinting   = true;
-    var $microSecondsPrinting = true;
+    protected $threadPrinting    = true;
+    protected $categoryPrefixing = true;
+    protected $contextPrinting   = true;
+    protected $microSecondsPrinting = true;
     
     /**
      * @var string date format. See {@link PHP_MANUAL#strftime} for details
      */
-    var $dateFormat = '%c';
+    protected $dateFormat = '%c';
 
     /**
      * Constructor
@@ -93,10 +86,10 @@ class LoggerLayoutTTCC extends LoggerLayout {
      * @param string date format
      * @see dateFormat
      */
-    function LoggerLayoutTTCC($dateFormat = '')
-    {
-        if (!empty($dateFormat))
+    public function __construct($dateFormat = '') {
+        if (!empty($dateFormat)) {
             $this->dateFormat = $dateFormat;
+        }
         return;
     }
 
@@ -104,9 +97,7 @@ class LoggerLayoutTTCC extends LoggerLayout {
      * The <b>ThreadPrinting</b> option specifies whether the name of the
      * current thread is part of log output or not. This is true by default.
      */
-    function setThreadPrinting($threadPrinting)
-    {
-        
+    public function setThreadPrinting($threadPrinting) {
         $this->threadPrinting = is_bool($threadPrinting) ? 
             $threadPrinting : 
             (bool)(strtolower($threadPrinting) == 'true'); 
@@ -115,7 +106,7 @@ class LoggerLayoutTTCC extends LoggerLayout {
     /**
      * @return boolean Returns value of the <b>ThreadPrinting</b> option.
      */
-    function getThreadPrinting() {
+    public function getThreadPrinting() {
         return $this->threadPrinting;
     }
 
@@ -123,17 +114,14 @@ class LoggerLayoutTTCC extends LoggerLayout {
      * The <b>CategoryPrefixing</b> option specifies whether {@link Category}
      * name is part of log output or not. This is true by default.
      */
-    function setCategoryPrefixing($categoryPrefixing)
-    {
-        $this->categoryPrefixing = is_bool($categoryPrefixing) ?
-            $categoryPrefixing :
-            (bool)(strtolower($categoryPrefixing) == 'true');
+    public function setCategoryPrefixing($categoryPrefixing) {
+        $this->categoryPrefixing = LoggerOptionConverter::toBoolean($categoryPrefixing);
     }
 
     /**
      * @return boolean Returns value of the <b>CategoryPrefixing</b> option.
      */
-    function getCategoryPrefixing() {
+    public function getCategoryPrefixing() {
         return $this->categoryPrefixing;
     }
 
@@ -142,17 +130,14 @@ class LoggerLayoutTTCC extends LoggerLayout {
      * the nested context information belonging to the current thread.
      * This is true by default.
      */
-    function setContextPrinting($contextPrinting) {
-        $this->contextPrinting = is_bool($contextPrinting) ? 
-            $contextPrinting : 
-            (bool)(strtolower($contextPrinting) == 'true'); 
+    public function setContextPrinting($contextPrinting) {
+        $this->contextPrinting = LoggerOptionConverter::toBoolean($contextPrinting); 
     }
 
     /**
      * @return boolean Returns value of the <b>ContextPrinting</b> option.
      */
-    function getContextPrinting()
-    {
+    public function getContextPrinting() {
         return $this->contextPrinting;
     }
     
@@ -161,7 +146,7 @@ class LoggerLayoutTTCC extends LoggerLayout {
      * should be printed at the end of timestamp.
      * This is true by default.
      */
-    function setMicroSecondsPrinting($microSecondsPrinting) {
+    public function setMicroSecondsPrinting($microSecondsPrinting) {
         $this->microSecondsPrinting = is_bool($microSecondsPrinting) ? 
             $microSecondsPrinting : 
             (bool)(strtolower($microSecondsPrinting) == 'true'); 
@@ -170,22 +155,19 @@ class LoggerLayoutTTCC extends LoggerLayout {
     /**
      * @return boolean Returns value of the <b>MicroSecondsPrinting</b> option.
      */
-    function getMicroSecondsPrinting()
-    {
+    public function getMicroSecondsPrinting() {
         return $this->microSecondsPrinting;
     }
     
     
-    function setDateFormat($dateFormat)
-    {
+    public function setDateFormat($dateFormat) {
         $this->dateFormat = $dateFormat;
     }
     
     /**
      * @return string
      */
-    function getDateFormat()
-    {
+    public function getDateFormat() {
         return $this->dateFormat;
     }
 
@@ -197,21 +179,21 @@ class LoggerLayoutTTCC extends LoggerLayout {
      * @param LoggerLoggingEvent $event
      * @return string
      */
-    function format($event)
-    {
+    public function format(LoggerLoggingEvent $event) {
         $timeStamp = (float)$event->getTimeStamp();
         $format = strftime($this->dateFormat, (int)$timeStamp);
         
         if ($this->microSecondsPrinting) {
-            $usecs = round(($timeStamp - (int)$timeStamp) * 1000);
+            $usecs = floor(($timeStamp - (int)$timeStamp) * 1000);
             $format .= sprintf(',%03d', $usecs);
         }
             
         $format .= ' ';
         
-        if ($this->threadPrinting)
+        if ($this->threadPrinting) {
             $format .= '['.getmypid().'] ';
-       
+        }
+        
         $level = $event->getLevel();
         $format .= $level->toString().' ';
         
@@ -222,19 +204,18 @@ class LoggerLayoutTTCC extends LoggerLayout {
         if($this->contextPrinting) {
             $ndc = $event->getNDC();
             if($ndc != null) {
-    	        $format .= $ndc.' ';
+                $format .= $ndc.' ';
             }
         }
         
         $format .= '- '.$event->getRenderedMessage();
-        $format .= LOG4PHP_LINE_SEP;
+        $format .= PHP_EOL;
         
         return $format;
     }
 
-    function ignoresThrowable()
-    {
+    public function ignoresThrowable() {
         return true;
     }
 }
-?>
\ No newline at end of file
+?>
diff --git a/libraries/log4php.debug/layouts/LoggerLayoutXml.php b/libraries/log4php.debug/layouts/LoggerLayoutXml.php
new file mode 100644
index 000000000..e9296256c
--- /dev/null
+++ b/libraries/log4php.debug/layouts/LoggerLayoutXml.php
@@ -0,0 +1,222 @@
+<?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 output of the LoggerXmlLayout consists of a series of log4php:event elements. 
+ * 
+ * <p>Parameters: {@link $locationInfo}.</p>
+ *
+ * <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>
+ * 
+ * Example:
+ * 
+ * {@example ../../examples/php/layout_xml.php 19}<br>
+ * 
+ * {@example ../../examples/resources/layout_xml.properties 18}<br>
+ *
+ * The above would print:
+ * 
+ * <pre>
+ *   <log4php:eventSet xmlns:log4php="http://logging.apache.org/log4php/" version="0.3" includesLocationInfo="true">
+ *     <log4php:event logger="root" level="INFO" thread="13802" timestamp="1252456226491">
+ *       <log4php:message><![CDATA[Hello World!]]></log4php:message>
+ *       <log4php:locationInfo class="main" file="examples/php/layout_xml.php" line="6" method="main" />
+ *     </log4php:event>
+ *   </log4php:eventSet>
+ * </pre>
+ *
+ * @version $Revision: 883108 $
+ * @package log4php
+ * @subpackage layouts
+ */
+class LoggerLayoutXml extends LoggerLayout {
+	const LOG4J_NS_PREFIX ='log4j';
+	const LOG4J_NS = 'http://jakarta.apache.org/log4j/';
+	
+	const LOG4PHP_NS_PREFIX = 'log4php';
+	const LOG4PHP_NS = 'http://logging.apache.org/log4php/';
+	
+	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;
+  
+    /**
+     * @var boolean set the elements namespace
+     */
+    private $log4jNamespace = false;
+    
+    
+    /**
+     * @var string namespace
+     * @private
+     */
+    private $_namespace = self::LOG4PHP_NS;
+    
+    /**
+     * @var string namespace prefix
+     * @private
+     */
+    private $_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;
+        } else {
+            $this->_namespace        = self::LOG4PHP_NS;
+            $this->_namespacePrefix  = self::LOG4PHP_NS_PREFIX;
+        }     
+    }
+    
+    /**
+     * @return string
+     */
+    public function getHeader() {
+        return "<{$this->_namespacePrefix}:eventSet ".
+                    "xmlns:{$this->_namespacePrefix}=\"{$this->_namespace}\" ".
+                    "version=\"0.3\" ".
+                    "includesLocationInfo=\"".($this->getLocationInfo() ? "true" : "false")."\"".
+               ">\r\n";
+    }
+
+    /**
+     * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd.
+     *
+     * @param LoggerLoggingEvent $event
+     * @return string
+     */
+    public function format(LoggerLoggingEvent $event) {
+    	$loggerName = $event->getLoggerName();
+        $timeStamp  = number_format((float)($event->getTimeStamp() * 1000), 0, '', '');
+        $thread     = $event->getThreadName();
+        $level      = $event->getLevel();
+        $levelStr   = $level->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;        
+
+        $ndc = $event->getNDC();
+        if($ndc != null) {
+            $buf .= "<{$this->_namespacePrefix}:NDC><![CDATA[";
+            $this->appendEscapingCDATA($buf, $ndc);
+            $buf .= "]]></{$this->_namespacePrefix}:NDC>".PHP_EOL;       
+        }
+
+        if ($this->getLocationInfo()) {
+            $locationInfo = $event->getLocationInformation();
+            $buf .= "<{$this->_namespacePrefix}: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;
+        
+        return $buf;
+
+    }
+    
+    /**
+     * @return string
+     */
+    public function getFooter() {
+        return "</{$this->_namespacePrefix}:eventSet>\r\n";
+    }
+    
+    
+    /** Whether or not file name and line number will be included in the output.
+     * 
+     * @return boolean
+     */
+    public function getLocationInfo() {
+        return $this->locationInfo;
+    }
+  
+    /**
+     * The {@link $locationInfo} option takes a boolean value. By default,
+     * it is set to false which means there will be no location
+     * information output by this layout. If the the option is set to
+     * true, then the file name and line number of the statement at the
+     * origin of the log statement will be output.
+     */
+    public function setLocationInfo($flag) {
+        $this->locationInfo = LoggerOptionConverter::toBoolean($flag, true);
+    }
+  
+	/**
+	 * @return boolean
+	 */
+	 public function getLog4jNamespace() {
+	 	return $this->log4jNamespace;
+	 }
+
+    /**
+     * @param boolean
+     */
+    public function setLog4jNamespace($flag) {
+        $this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, true);
+    }
+    
+    /**
+	 * 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  
+	 */
+	private function appendEscapingCDATA(&$buf, $str) {
+		if(empty($str)) {
+			return;
+		}
+	
+		$rStr = str_replace(
+			self::CDATA_END,
+			self::CDATA_EMBEDDED_END,
+			$str
+		);
+		$buf .= $rStr;
+	}
+}
+
diff --git a/libraries/log4php.debug/layouts/LoggerXmlLayout.php b/libraries/log4php.debug/layouts/LoggerXmlLayout.php
deleted file mode 100644
index d8c61dd7a..000000000
--- a/libraries/log4php.debug/layouts/LoggerXmlLayout.php
+++ /dev/null
@@ -1,206 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage layouts
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
-
-define('LOG4PHP_LOGGER_XML_LAYOUT_LOG4J_NS_PREFIX',     'log4j');
-define('LOG4PHP_LOGGER_XML_LAYOUT_LOG4J_NS',            'http://jakarta.apache.org/log4j/');
-
-define('LOG4PHP_LOGGER_XML_LAYOUT_LOG4PHP_NS_PREFIX',   'log4php');
-define('LOG4PHP_LOGGER_XML_LAYOUT_LOG4PHP_NS',          'http://www.vxr.it/log4php/');
-
-/**
- */
-require_once(LOG4PHP_DIR . '/helpers/LoggerOptionConverter.php');
-require_once(LOG4PHP_DIR . '/helpers/LoggerTransform.php');
-require_once(LOG4PHP_DIR . '/LoggerLayout.php');
-
-/**
- * The output of the LoggerXmlLayout consists of a series of log4php:event elements. 
- * 
- * <p>Parameters: {@link $locationInfo}.</p>
- *
- * <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>
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.16 $
- * @package log4php
- * @subpackage layouts
- */
-class LoggerXmlLayout 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
-     * information output by this layout. If the the option is set to
-     * true, then the file name and line number of the statement at the
-     * origin of the log statement will be output.
-     * @var boolean
-     */
-    var $locationInfo = true;
-  
-    /**
-     * @var boolean set the elements namespace
-     */
-    var $log4jNamespace = false;
-    
-    
-    /**
-     * @var string namespace
-     * @private
-     */
-    var $_namespace = LOG4PHP_LOGGER_XML_LAYOUT_LOG4PHP_NS;
-    
-    /**
-     * @var string namespace prefix
-     * @private
-     */
-    var $_namespacePrefix = LOG4PHP_LOGGER_XML_LAYOUT_LOG4PHP_NS_PREFIX;
-     
-    /** 
-     * No options to activate. 
-     */
-    function activateOptions()
-    {
-        if ($this->getLog4jNamespace()) {
-            $this->_namespace        = LOG4PHP_LOGGER_XML_LAYOUT_LOG4J_NS;
-            $this->_namespacePrefix  = LOG4PHP_LOGGER_XML_LAYOUT_LOG4J_NS_PREFIX;
-        } else {
-            $this->_namespace        = LOG4PHP_LOGGER_XML_LAYOUT_LOG4PHP_NS;
-            $this->_namespacePrefix  = LOG4PHP_LOGGER_XML_LAYOUT_LOG4PHP_NS_PREFIX;
-        }     
-    }
-    
-    /**
-     * @return string
-     */
-    function getHeader()
-    {
-        return "<{$this->_namespacePrefix}:eventSet ".
-                    "xmlns:{$this->_namespacePrefix}=\"{$this->_namespace}\" ".
-                    "version=\"0.3\" ".
-                    "includesLocationInfo=\"".($this->getLocationInfo() ? "true" : "false")."\"".
-               ">\r\n";
-    }
-
-    /**
-     * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd.
-     *
-     * @param LoggerLoggingEvent $event
-     * @return string
-     */
-    function format($event)
-    {
-        $loggerName = $event->getLoggerName();
-        $timeStamp  = number_format((float)($event->getTimeStamp() * 1000), 0, '', '');
-        $thread     = $event->getThreadName();
-        $level      = $event->getLevel();
-        $levelStr   = $level->toString();
-
-        $buf = "<{$this->_namespacePrefix}:event logger=\"{$loggerName}\" level=\"{$levelStr}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">\r\n";
-        $buf .= "<{$this->_namespacePrefix}:message><![CDATA["; 
-        LoggerTransform::appendEscapingCDATA($buf, $event->getRenderedMessage()); 
-        $buf .= "]]></{$this->_namespacePrefix}:message>\r\n";        
-
-        $ndc = $event->getNDC();
-        if($ndc != null) {
-            $buf .= "<{$this->_namespacePrefix}:NDC><![CDATA[";
-            LoggerTransform::appendEscapingCDATA($buf, $ndc);
-            $buf .= "]]></{$this->_namespacePrefix}:NDC>\r\n";       
-        }
-
-        if ($this->getLocationInfo()) {
-            $locationInfo = $event->getLocationInformation();
-            $buf .= "<{$this->_namespacePrefix}:locationInfo ". 
-                    "class=\"" . $locationInfo->getClassName() . "\" ".
-                    "file=\"" .  htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" ".
-                    "line=\"" .  $locationInfo->getLineNumber() . "\" ".
-                    "method=\"" . $locationInfo->getMethodName() . "\" ";
-            $buf .= "/>\r\n";
-
-        }
-
-        $buf .= "</{$this->_namespacePrefix}:event>\r\n\r\n";
-        
-        return $buf;
-
-    }
-    
-    /**
-     * @return string
-     */
-    function getFooter()
-    {
-
-        return "</{$this->_namespacePrefix}:eventSet>\r\n";
-    }
-    
-    /**
-     * @return boolean
-     */
-    function getLocationInfo()
-    {
-        return $this->locationInfo;
-    }
-  
-    /**
-     * @return boolean
-     */
-    function getLog4jNamespace()
-    {
-        return $this->log4jNamespace;
-    }
-
-    /**
-     * The XMLLayout prints and does not ignore exceptions. Hence the
-     * return value <b>false</b>.
-     * @return boolean
-     */
-    function ignoresThrowable()
-    {
-        return false;
-    }
-    
-    /**
-     * The {@link $locationInfo} option takes a boolean value. By default,
-     * it is set to false which means there will be no location
-     * information output by this layout. If the the option is set to
-     * true, then the file name and line number of the statement at the
-     * origin of the log statement will be output.
-     */
-    function setLocationInfo($flag)
-    {
-        $this->locationInfo = LoggerOptionConverter::toBoolean($flag, true);
-    }
-  
-    /**
-     * @param boolean
-     */
-    function setLog4jNamespace($flag)
-    {
-        $this->log4jNamespace = LoggerOptionConverter::toBoolean($flag, true);
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/or/LoggerDefaultRenderer.php b/libraries/log4php.debug/or/LoggerDefaultRenderer.php
deleted file mode 100644
index c2e44c38c..000000000
--- a/libraries/log4php.debug/or/LoggerDefaultRenderer.php
+++ /dev/null
@@ -1,58 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage or
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/or/LoggerObjectRenderer.php');
-
-/**
- * The default Renderer renders objects by type casting
- *
- * @author VxR <vxr@vxr.it>
- * @package log4php
- * @subpackage or
- * @since 0.3
- */
-class LoggerDefaultRenderer extends LoggerObjectRenderer{
-  
-    /**
-     * Constructor
-     */
-    function LoggerDefaultRenderer()
-    {
-        return;
-    }
-
-    /**
-     * Render objects by type casting
-     *
-     * @param mixed $o the object to render
-     * @return string
-     */
-    function doRender($o)
-    {
-        return var_export($o, true);
-    }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/or/LoggerObjectRenderer.php b/libraries/log4php.debug/or/LoggerObjectRenderer.php
deleted file mode 100644
index 5279690f8..000000000
--- a/libraries/log4php.debug/or/LoggerObjectRenderer.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage or
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- * Subclass this abstract class in order to render objects as strings.
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.3 $
- * @package log4php
- * @subpackage or
- * @abstract
- * @since 0.3
- */
-class LoggerObjectRenderer {
-
-    /**
-     * @param string $class classname
-     * @return LoggerObjectRenderer create LoggerObjectRenderer instances
-     */
-    function factory($class)
-    {
-        if (!empty($class)) {
-            $class = basename($class);
-            @include_once(LOG4PHP_DIR . "/or/{$class}.php");
-            if (class_exists($class)) {
-                return new $class();
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Render the entity passed as parameter as a String.
-     * @param mixed $o entity to render
-     * @return string
-     */
-    function doRender($o)
-    {
-        // abstract
-    }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/or/LoggerRendererMap.php b/libraries/log4php.debug/or/LoggerRendererMap.php
deleted file mode 100644
index 1d9d29e17..000000000
--- a/libraries/log4php.debug/or/LoggerRendererMap.php
+++ /dev/null
@@ -1,184 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage or
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/or/LoggerDefaultRenderer.php');
-require_once(LOG4PHP_DIR . '/or/LoggerObjectRenderer.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
-/**
- * Map class objects to an {@link LoggerObjectRenderer}.
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.4 $
- * @package log4php
- * @subpackage or
- * @since 0.3
- */
-class LoggerRendererMap {
-
-    /**
-     * @var array
-     */
-    var $map;
-
-    /**
-     * @var LoggerDefaultRenderer
-     */
-    var $defaultRenderer;
-
-    /**
-     * Constructor
-     */
-    function LoggerRendererMap()
-    {
-        $this->map = array();
-        $this->defaultRenderer = new LoggerDefaultRenderer();
-    }
-
-    /**
-     * Add a renderer to a hierarchy passed as parameter.
-     * Note that hierarchy must implement getRendererMap() and setRenderer() methods.
-     *
-     * @param LoggerHierarchy &$repository a logger repository.
-     * @param string &$renderedClassName
-     * @param string &$renderingClassName
-     * @static
-     */
-    function addRenderer(&$repository, $renderedClassName, $renderingClassName)
-    {
-        LoggerLog::debug("LoggerRendererMap::addRenderer() Rendering class: [{$renderingClassName}], Rendered class: [{$renderedClassName}].");
-        $renderer = LoggerObjectRenderer::factory($renderingClassName);
-        if($renderer == null) {
-            LoggerLog::warn("LoggerRendererMap::addRenderer() Could not instantiate renderer [{$renderingClassName}].");
-            return;
-        } else {
-            $repository->setRenderer($renderedClassName, $renderer);
-        }
-    }
-
-
-    /**
-     * Find the appropriate renderer for the class type of the
-     * <var>o</var> parameter. 
-     *
-     * This is accomplished by calling the {@link getByObject()} 
-     * method if <var>o</var> is object or using {@link LoggerDefaultRenderer}. 
-     * Once a renderer is found, it is applied on the object <var>o</var> and 
-     * the result is returned as a string.
-     *
-     * @param mixed $o
-     * @return string 
-     */
-    function findAndRender($o)
-    {
-        if($o == null) {
-            return null;
-        } else {
-            if (is_object($o)) {
-                $renderer = $this->getByObject($o);
-                if ($renderer !== null) {
-                    return $renderer->doRender($o);
-                } else {
-                    return null;
-                }
-            } else {
-                $renderer = $this->defaultRenderer;
-                return $renderer->doRender($o);
-            }
-        }
-    }
-
-    /**
-     * Syntactic sugar method that calls {@link PHP_MANUAL#get_class} with the
-     * class of the object parameter.
-     * 
-     * @param mixed $o
-     * @return string
-     */
-    function &getByObject($o)
-    {
-        return ($o == null) ? null : $this->getByClassName(get_class($o));
-    }
-
-
-    /**
-     * Search the parents of <var>clazz</var> for a renderer. 
-     *
-     * The renderer closest in the hierarchy will be returned. If no
-     * renderers could be found, then the default renderer is returned.
-     *
-     * @param string $class
-     * @return LoggerObjectRenderer
-     */
-    function &getByClassName($class)
-    {
-        $r = null;
-        for($c = strtolower($class); !empty($c); $c = get_parent_class($c)) {
-            if (isset($this->map[$c])) {
-                return  $this->map[$c];
-            }
-        }
-        return $this->defaultRenderer;
-    }
-
-    /**
-     * @return LoggerDefaultRenderer
-     */
-    function &getDefaultRenderer()
-    {
-        return $this->defaultRenderer;
-    }
-
-
-    function clear()
-    {
-        $this->map = array();
-    }
-
-    /**
-     * Register a {@link LoggerObjectRenderer} for <var>clazz</var>.
-     * @param string $class
-     * @param LoggerObjectRenderer $or
-     */
-    function put($class, $or)
-    {
-        $this->map[strtolower($class)] = $or;
-    }
-    
-    /**
-     * @param string $class
-     * @return boolean
-     */
-    function rendererExists($class)
-    {
-        $class = basename($class);
-        if (!class_exists($class)) {
-            @include_once(LOG4PHP_DIR ."/or/{$class}.php");
-        }
-        return class_exists($class);
-    }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/renderers/LoggerRendererDefault.php b/libraries/log4php.debug/renderers/LoggerRendererDefault.php
new file mode 100644
index 000000000..294fe6e6a
--- /dev/null
+++ b/libraries/log4php.debug/renderers/LoggerRendererDefault.php
@@ -0,0 +1,51 @@
+<?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 default Renderer renders objects by type casting.
+ * 
+ * Example:
+ * 
+ * {@example ../../examples/php/renderer_default.php 19}<br>
+ * {@example ../../examples/resources/renderer_default.properties 18}<br>
+ * <pre>
+ * DEBUG - Now comes the current MyClass object:
+ * DEBUG - Person::__set_state(array(
+ *  'firstName' => 'John',
+ *  'lastName' => 'Doe',
+ * ))
+ * </pre>
+ *
+ * @package log4php
+ * @subpackage renderers
+ * @since 0.3
+ */
+class LoggerRendererDefault implements LoggerRendererObject {
+
+	/**
+	 * Render objects by type casting
+	 *
+	 * @param mixed $o the object to render
+	 * @return string
+	 */
+	public function render($o) {
+		return var_export($o, true);
+	}
+}
diff --git a/libraries/log4php.debug/renderers/LoggerRendererMap.php b/libraries/log4php.debug/renderers/LoggerRendererMap.php
new file mode 100644
index 000000000..39fe9c5f7
--- /dev/null
+++ b/libraries/log4php.debug/renderers/LoggerRendererMap.php
@@ -0,0 +1,149 @@
+<?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
+ */
+
+/**
+ * Log objects using customized renderers that implement {@link LoggerRendererObject}.
+ *
+ * Example:
+ * {@example ../../examples/php/renderer_map.php 19}<br>
+ * {@example ../../examples/resources/renderer_map.properties 18}<br>
+ * <pre>
+ * DEBUG - Now comes the current MyClass object:
+ * DEBUG - Doe, John
+ * </pre>
+ * 
+ * @version $Revision: 883108 $
+ * @package log4php
+ * @subpackage renderers
+ * @since 0.3
+ */
+class LoggerRendererMap {
+
+	/**
+	 * @var array
+	 */
+	private $map;
+
+	/**
+	 * @var LoggerDefaultRenderer
+	 */
+	private $defaultRenderer;
+
+	/**
+	 * Constructor
+	 */
+	public function __construct() {
+		$this->map = array();
+		$this->defaultRenderer = new LoggerRendererDefault();
+	}
+
+	/**
+	 * Add a renderer to a hierarchy passed as parameter.
+	 * Note that hierarchy must implement getRendererMap() and setRenderer() methods.
+	 *
+	 * @param LoggerHierarchy $repository a logger repository.
+	 * @param string $renderedClassName
+	 * @param string $renderingClassName
+	 * @static
+	 */
+	public function addRenderer($renderedClassName, $renderingClassName) {
+		$renderer = LoggerReflectionUtils::createObject($renderingClassName);
+		if($renderer == null) {
+			return;
+		} else {
+			$this->put($renderedClassName, $renderer);
+		}
+	}
+
+
+	/**
+	 * Find the appropriate renderer for the class type of the
+	 * <var>o</var> parameter. 
+	 *
+	 * This is accomplished by calling the {@link getByObject()} 
+	 * method if <var>o</var> is object or using {@link LoggerRendererDefault}. 
+	 * Once a renderer is found, it is applied on the object <var>o</var> and 
+	 * the result is returned as a string.
+	 *
+	 * @param mixed $o
+	 * @return string 
+	 */
+	public function findAndRender($o) {
+		if($o == null) {
+			return null;
+		} else {
+			if(is_object($o)) {
+				$renderer = $this->getByObject($o);
+				if($renderer !== null) {
+					return $renderer->render($o);
+				} else {
+					return null;
+				}
+			} else {
+				$renderer = $this->defaultRenderer;
+				return $renderer->render($o);
+			}
+		}
+	}
+
+	/**
+	 * Syntactic sugar method that calls {@link PHP_MANUAL#get_class} with the
+	 * class of the object parameter.
+	 * 
+	 * @param mixed $o
+	 * @return string
+	 */
+	public function getByObject($o) {
+		return ($o == null) ? null : $this->getByClassName(get_class($o));
+	}
+
+
+	/**
+	 * Search the parents of <var>clazz</var> for a renderer. 
+	 *
+	 * The renderer closest in the hierarchy will be returned. If no
+	 * renderers could be found, then the default renderer is returned.
+	 *
+	 * @param string $class
+	 * @return LoggerRendererObject
+	 */
+	public function getByClassName($class) {
+		$r = null;
+		for($c = strtolower($class); !empty($c); $c = get_parent_class($c)) {
+			if(isset($this->map[$c])) {
+				return $this->map[$c];
+			}
+		}
+		return $this->defaultRenderer;
+	}
+
+	public function clear() {
+		$this->map = array();
+	}
+
+	/**
+	 * Register a {@link LoggerRendererObject} for <var>clazz</var>.
+	 * @param string $class
+	 * @param LoggerRendererObject $or
+	 */
+	private function put($class, $or) {
+		$this->map[strtolower($class)] = $or;
+	}
+}
diff --git a/libraries/log4php.debug/renderers/LoggerRendererObject.php b/libraries/log4php.debug/renderers/LoggerRendererObject.php
new file mode 100644
index 000000000..3f0e39e9b
--- /dev/null
+++ b/libraries/log4php.debug/renderers/LoggerRendererObject.php
@@ -0,0 +1,46 @@
+<?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
+ */
+
+/**
+ * Implement this interface in order to render objects as strings using {@link LoggerRendererMap}.
+ *
+ * Implement this interface in order to render objects as strings using {@link LoggerRendererMap}.
+ *
+ * Example:
+ * {@example ../../examples/php/renderer_map.php 19}<br>
+ * {@example ../../examples/resources/renderer_map.properties 18}<br>
+ * <pre>
+ * DEBUG - Now comes the current MyClass object:
+ * DEBUG - Doe, John
+ * </pre>
+ *
+ * @version $Revision: 883108 $
+ * @package log4php
+ * @subpackage renderers
+ * @since 0.3
+ */
+interface LoggerRendererObject {
+	/**
+	 * Render the entity passed as parameter as a String.
+	 * @param mixed $o entity to render
+	 * @return string
+	 */
+	public function render($o);
+}
diff --git a/libraries/log4php.debug/spi/LoggerConfigurator.php b/libraries/log4php.debug/spi/LoggerConfigurator.php
deleted file mode 100644
index 944f18878..000000000
--- a/libraries/log4php.debug/spi/LoggerConfigurator.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage spi
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__)); 
-
-/**
- * Special level value signifying inherited behaviour. The current
- * value of this string constant is <b>inherited</b>. 
- * {@link LOG4PHP_LOGGER_CONFIGURATOR_NULL} is a synonym.  
- */
-define('LOG4PHP_LOGGER_CONFIGURATOR_INHERITED', 'inherited');
-
-/**
- * Special level signifying inherited behaviour, same as 
- * {@link LOG4PHP_LOGGER_CONFIGURATOR_INHERITED}. 
- * The current value of this string constant is <b>null</b>. 
- */
-define('LOG4PHP_LOGGER_CONFIGURATOR_NULL',      'null');
-
-/**
- * Implemented by classes capable of configuring log4php using a URL.
- *  
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.2 $
- * @package log4php
- * @subpackage spi  
- * @since 0.5
- * @abstract
- */
-class LoggerConfigurator {
-
-   /**
-    * 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
-    * @param LoggerHierarchy &$repository The hierarchy to operation upon.
-    */
-    function doConfigure($url, &$repository)
-    {
-        return;
-    }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/spi/LoggerFactory.php b/libraries/log4php.debug/spi/LoggerFactory.php
deleted file mode 100644
index 5a8164e62..000000000
--- a/libraries/log4php.debug/spi/LoggerFactory.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage spi
- */
-
-/**
- * @ignore
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
-
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-
-/**
- * Extend and implement this abstract class to create new instances of 
- * {@link Logger} or a sub-class of {@link Logger}.
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.3 $
- * @package log4php
- * @subpackage spi
- * @since 0.5 
- * @abstract
- */
-class LoggerFactory {
-
-    /**
-     * @abstract
-     * @param string $name
-     * @return Logger
-     */
-    function makeNewLoggerInstance($name)
-    {
-        LoggerLog::warn("LoggerFactory:: makeNewLoggerInstance() is abstract.");
-        return null;
-    }
-
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/spi/LoggerFilter.php b/libraries/log4php.debug/spi/LoggerFilter.php
deleted file mode 100644
index 8baf54798..000000000
--- a/libraries/log4php.debug/spi/LoggerFilter.php
+++ /dev/null
@@ -1,113 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage spi
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- * The log event must be logged immediately without consulting with
- * the remaining filters, if any, in the chain.  
- */
-define('LOG4PHP_LOGGER_FILTER_ACCEPT',  1);
-
-/**
- * This filter is neutral with respect to the log event. The
- * remaining filters, if any, should be consulted for a final decision.
- */
-define('LOG4PHP_LOGGER_FILTER_NEUTRAL', 0);
-
-/**
- * The log event must be dropped immediately without consulting
- *  with the remaining filters, if any, in the chain.  
- */
-define('LOG4PHP_LOGGER_FILTER_DENY',    -1);
-
-/**
- * Users should extend this class to implement customized logging
- * event filtering. Note that {@link LoggerCategory} and {@link LoggerAppenderSkeleton}, 
- * the parent class of all standard
- * appenders, have built-in filtering rules. It is suggested that you
- * first use and understand the built-in rules before rushing to write
- * your own custom filters.
- * 
- * <p>This abstract class assumes and also imposes that filters be
- * organized in a linear chain. The {@link #decide
- * decide(LoggerLoggingEvent)} method of each filter is called sequentially,
- * in the order of their addition to the chain.
- * 
- * <p>The {@link decide()} method must return one
- * of the integer constants {@link LOG4PHP_LOG4PHP_LOGGER_FILTER_DENY}, 
- * {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} or {@link LOG4PHP_LOGGER_FILTER_ACCEPT}.
- * 
- * <p>If the value {@link LOG4PHP_LOGGER_FILTER_DENY} is returned, then the log event is
- * dropped immediately without consulting with the remaining
- * filters. 
- * 
- * <p>If the value {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} is returned, then the next filter
- * in the chain is consulted. If there are no more filters in the
- * chain, then the log event is logged. Thus, in the presence of no
- * filters, the default behaviour is to log all logging events.
- * 
- * <p>If the value {@link LOG4PHP_LOGGER_FILTER_ACCEPT} is returned, then the log
- * event is logged without consulting the remaining filters. 
- * 
- * <p>The philosophy of log4php filters is largely inspired from the
- * Linux ipchains. 
- * 
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.4 $
- * @package log4php
- * @subpackage spi
- */
-class LoggerFilter {
-
-    /**
-     * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain.
-     */
-    var $next;
-
-    /**
-     * Usually filters options become active when set. We provide a
-     * default do-nothing implementation for convenience.
-    */
-    function activateOptions()
-    {
-        return;
-    }
-
-    /**   
-     * Decide what to do.  
-     * <p>If the decision is {@link LOG4PHP_LOGGER_FILTER_DENY}, then the event will be
-     * dropped. If the decision is {@link LOG4PHP_LOGGER_FILTER_NEUTRAL}, then the next
-     * filter, if any, will be invoked. If the decision is {@link LOG4PHP_LOGGER_FILTER_ACCEPT} then
-     * the event will be logged without consulting with other filters in
-     * the chain.
-     *
-     * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon.
-     * @return integer {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} or {@link LOG4PHP_LOGGER_FILTER_DENY}|{@link LOG4PHP_LOGGER_FILTER_ACCEPT}
-     */
-    function decide($event)
-    {
-        return LOG4PHP_LOGGER_FILTER_NEUTRAL;
-    }
-
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/spi/LoggerLocationInfo.php b/libraries/log4php.debug/spi/LoggerLocationInfo.php
deleted file mode 100644
index cc4613370..000000000
--- a/libraries/log4php.debug/spi/LoggerLocationInfo.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage spi
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
-
-/**
- * When location information is not available the constant
- * <i>NA</i> is returned. Current value of this string
- * constant is <b>?</b>.  
- */
-define('LOG4PHP_LOGGER_LOCATION_INFO_NA',  'NA');
-
-/**
- * The internal representation of caller location information.
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.5 $
- * @package log4php
- * @subpackage spi
- * @since 0.3
- */
-class LoggerLocationInfo {
-
-    /**
-    * @var string Caller's line number.
-    */
-    var $lineNumber = null;
-    
-    /**
-    * @var string Caller's file name.
-    */
-    var $fileName = null;
-    
-    /**
-    * @var string Caller's fully qualified class name.
-    */
-    var $className = null;
-    
-    /**
-    * @var string Caller's method name.
-    */
-    var $methodName = null;
-    
-    /**
-    * @var string 
-    */
-    var $fullInfo = null;
-
-    /**
-     * Instantiate location information based on a {@link PHP_MANUAL#debug_backtrace}.
-     *
-     * @param array $trace
-     * @param mixed $caller
-     */
-    function LoggerLocationInfo($trace, $fqcn = null)
-    {
-        $this->lineNumber   = isset($trace['line']) ? $trace['line'] : null;
-        $this->fileName     = isset($trace['file']) ? $trace['file'] : null;
-        $this->className    = isset($trace['class']) ? $trace['class'] : null;
-        $this->methodName   = isset($trace['function']) ? $trace['function'] : null;
-        
-        $this->fullInfo = $this->getClassName() . '.' . $this->getMethodName() . 
-                          '(' . $this->getFileName() . ':' . $this->getLineNumber() . ')';
-    }
-
-    function getClassName()
-    {
-        return ($this->className === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->className; 
-    }
-
-    /**
-     *  Return the file name of the caller.
-     *  <p>This information is not always available.
-     */
-    function getFileName()
-    {
-        return ($this->fileName === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->fileName; 
-    }
-
-    /**
-     *  Returns the line number of the caller.
-     *  <p>This information is not always available.
-     */
-    function getLineNumber()
-    {
-        return ($this->lineNumber === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->lineNumber; 
-    }
-
-    /**
-     *  Returns the method name of the caller.
-     */
-    function getMethodName()
-    {
-        return ($this->methodName === null) ? LOG4PHP_LOGGER_LOCATION_INFO_NA : $this->methodName; 
-    }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/spi/LoggerLoggingEvent.php b/libraries/log4php.debug/spi/LoggerLoggingEvent.php
deleted file mode 100644
index d842c0f62..000000000
--- a/libraries/log4php.debug/spi/LoggerLoggingEvent.php
+++ /dev/null
@@ -1,384 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage spi
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/spi/LoggerLocationInfo.php');
-require_once(LOG4PHP_DIR . '/LoggerManager.php');
-require_once(LOG4PHP_DIR . '/LoggerMDC.php');
-require_once(LOG4PHP_DIR . '/LoggerNDC.php');
-
-/**
- * The internal representation of logging event.
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.16 $
- * @package log4php
- * @subpackage spi 
- */
-class LoggerLoggingEvent {
-
-    /** 
-    * @var string Fully Qualified Class Name of the calling category class.
-    */
-    var $fqcn;
-    
-    /**
-    * @var Logger reference
-    */
-    var $logger = null;
-    
-    /** 
-    * The category (logger) name.
-    * This field will be marked as private in future
-    * releases. Please do not access it directly. 
-    * Use the {@link getLoggerName()} method instead.
-    * @deprecated 
-    */
-    var $categoryName;
-    
-    /** 
-    * Level of logging event.
-    * <p> This field should not be accessed directly. You shoud use the
-    * {@link getLevel()} method instead.
-    *
-    * @deprecated
-    * @var LoggerLevel
-    */
-    var $level;
-    
-    /** 
-     * @var string The nested diagnostic context (NDC) of logging event. 
-     */
-    var $ndc;
-    
-    /** 
-     * Have we tried to do an NDC lookup? If we did, there is no need
-     * to do it again.  Note that its value is always false when
-     * serialized. Thus, a receiving SocketNode will never use it's own
-     * (incorrect) NDC. See also writeObject method.
-     * @var boolean
-     */
-    var $ndcLookupRequired = true;
-    
-    /** 
-     * Have we tried to do an MDC lookup? If we did, there is no need
-     * to do it again.  Note that its value is always false when
-     * serialized. See also the getMDC and getMDCCopy methods.
-     * @var boolean  
-     */
-    var $mdcCopyLookupRequired = true;
-    
-    /** 
-     * @var mixed The application supplied message of logging event. 
-     */
-    var $message;
-    
-    /** 
-     * The application supplied message rendered through the log4php
-     * objet rendering mechanism. At present renderedMessage == message.
-     * @var string
-     */
-    var $renderedMessage;
-    
-    /** 
-     * The name of thread in which this logging event was generated.
-     * log4php saves here the process id via {@link PHP_MANUAL#getmypid getmypid()} 
-     * @var mixed
-     */
-    var $threadName = null;
-    
-    /** 
-    * The number of seconds elapsed from 1/1/1970 until logging event
-    * was created plus microseconds if available.
-    * @var float
-    */
-    var $timeStamp;
-    
-    /** 
-    * @var LoggerLocationInfo Location information for the caller. 
-    */
-    var $locationInfo = null;
-    
-    // Serialization
-    /*
-    var $serialVersionUID = -868428216207166145L;
-    var $PARAM_ARRAY = array();
-    var $TO_LEVEL = "toLevel";
-    var $TO_LEVEL_PARAMS = null;
-    var $methodCache = array(); // use a tiny table
-    */
-
-    /**
-    * Instantiate a LoggingEvent from the supplied parameters.
-    *
-    * <p>Except {@link $timeStamp} all the other fields of
-    * LoggerLoggingEvent are filled when actually needed.
-    *
-    * @param string $fqcn name of the caller class.
-    * @param mixed &$logger The {@link Logger} category of this event or the logger name.
-    * @param LoggerLevel $priority The level of this event.
-    * @param mixed $message The message of this event.
-    * @param integer $timeStamp the timestamp of this logging event.
-    */
-    function LoggerLoggingEvent($fqcn, &$logger, $priority, $message, $timeStamp = null)
-    {
-        $this->fqcn = $fqcn;
-        if (is_a($logger, 'logger')) {
-            $this->logger =& $logger;
-            $this->categoryName = $logger->getName();
-        } else {
-            $this->categoryName = (string)$logger;
-        }
-        $this->level = $priority;
-        $this->message = $message;
-        if ($timeStamp !== null and is_float($timeStamp)) {
-            $this->timeStamp = $timeStamp;
-        } else {
-            if (function_exists('microtime')) {
-                list($usecs, $secs) = explode(' ', microtime());
-                $this->timeStamp = ((float)$usecs + (float)$secs);
-            } else {
-                $this->timeStamp = time();
-            }
-        }
-    }
-
-    /**
-     * Set the location information for this logging event. The collected
-     * information is cached for future use.
-     *
-     * <p>This method uses {@link PHP_MANUAL#debug_backtrace debug_backtrace()} function (if exists)
-     * to collect informations about caller.</p>
-     * <p>It only recognize informations generated by {@link Logger} and its subclasses.</p>
-     * @return LoggerLocationInfo
-     */
-    function getLocationInformation()
-    {
-        if($this->locationInfo === null) {
-
-            $locationInfo = array();
-
-            if (function_exists('debug_backtrace')) {
-                $trace = debug_backtrace();
-                $prevHop = null;
-                // make a downsearch to identify the caller
-                $hop = array_pop($trace);
-                while ($hop !== null) {
-                    $className = @$hop['class'];
-                    if ( !empty($className) and ($className == 'logger' or get_parent_class($className) == 'logger') ) {
-                        $locationInfo['line'] = $hop['line'];
-                        $locationInfo['file'] = $hop['file'];                         
-                        break;
-                    }
-                    $prevHop = $hop;
-                    $hop = array_pop($trace);
-                }
-                $locationInfo['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
-                if (isset($prevHop['function']) and
-                    $prevHop['function'] !== 'include' and
-                    $prevHop['function'] !== 'include_once' and
-                    $prevHop['function'] !== 'require' and
-                    $prevHop['function'] !== 'require_once') {                                        
-    
-                    $locationInfo['function'] = $prevHop['function'];
-                } else {
-                    $locationInfo['function'] = 'main';
-                }
-            }
-                     
-            $this->locationInfo = new LoggerLocationInfo($locationInfo, $this->fqcn);
-        }
-        return $this->locationInfo;
-    }
-
-    /**
-     * Return the level of this event. Use this form instead of directly
-     * accessing the {@link $level} field.
-     * @return LoggerLevel  
-     */
-    function getLevel()
-    {
-        return $this->level;
-    }
-
-    /**
-     * Return the name of the logger. Use this form instead of directly
-     * accessing the {@link $categoryName} field.
-     * @return string  
-     */
-    function getLoggerName()
-    {
-        return $this->categoryName;
-    }
-
-    /**
-     * Return the message for this logging event.
-     *
-     * <p>Before serialization, the returned object is the message
-     * passed by the user to generate the logging event. After
-     * serialization, the returned value equals the String form of the
-     * message possibly after object rendering.
-     * @return mixed
-     */
-    function getMessage()
-    {
-        if($this->message !== null) {
-            return $this->message;
-        } else {
-            return $this->getRenderedMessage();
-        }
-    }
-
-    /**
-     * This method returns the NDC for this event. It will return the
-     * correct content even if the event was generated in a different
-     * thread or even on a different machine. The {@link LoggerNDC::get()} method
-     * should <b>never</b> be called directly.
-     * @return string  
-     */
-    function getNDC()
-    {
-        if ($this->ndcLookupRequired) {
-            $this->ndcLookupRequired = false;
-            $this->ndc = implode(' ',LoggerNDC::get());
-        }
-        return $this->ndc;
-    }
-
-
-    /**
-     * Returns the the context corresponding to the <code>key</code>
-     * parameter.
-     * @return string
-     */
-    function getMDC($key)
-    {
-        return LoggerMDC::get($key);
-    }
-
-    /**
-     * Render message.
-     * @return string
-     */
-    function getRenderedMessage()
-    {
-        if($this->renderedMessage === null and $this->message !== null) {
-            if (is_string($this->message)) {
-	            $this->renderedMessage = $this->message;
-            } else {
-                if ($this->logger !== null) {
-                    $repository =& $this->logger->getLoggerRepository();
-                } else {
-                    $repository =& LoggerManager::getLoggerRepository();
-                }
-                if (method_exists($repository, 'getrenderermap')) {
-                    $rendererMap =& $repository->getRendererMap();
-	                $this->renderedMessage= $rendererMap->findAndRender($this->message);
-	            } else {
-	                $this->renderedMessage = (string)$this->message;
-	            }
-            }
-        }
-        return $this->renderedMessage;
-    }
-
-    /**
-     * Returns the time when the application started, in seconds
-     * elapsed since 01.01.1970 plus microseconds if available.
-     *
-     * @return float
-     * @static
-     */
-    function getStartTime()
-    {
-        static $startTime;
-        
-        if (!isset($startTime)) {
-            if (function_exists('microtime')) {
-                list($usec, $sec) = explode(' ', microtime()); 
-                $startTime = ((float)$usec + (float)$sec);
-            } else {
-                $startTime = time();
-            }
-        }
-        return $startTime; 
-    }
-    
-    /**
-     * @return float
-     */
-    function getTimeStamp()
-    {
-        return $this->timeStamp;
-    }
-    
-    /**
-     * @return mixed
-     */
-    function getThreadName()
-    {
-        if ($this->threadName === null)
-            $this->threadName = (string)getmypid();
-        return $this->threadName;
-    }
-
-    /**
-     * @return mixed null
-     */
-    function getThrowableInformation()
-    {
-        return null;
-    }
-    
-    /**
-     * Serialize this object
-     * @return string
-     */
-    function toString()
-    {
-        serialize($this);
-    }
-    
-    /**
-     * Avoid serialization of the {@link $logger} object
-     */
-    function __sleep()
-    {
-        return array(
-            'fqcn','categoryName',
-            'level',
-            'ndc','ndcLookupRequired',
-            'message','renderedMessage',
-            'threadName',
-            'timestamp',
-            'locationInfo'
-        );
-    }
-
-}
-
-LoggerLoggingEvent::getStartTime();
-
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/tutorials/log4php/log4php.pkg b/libraries/log4php.debug/tutorials/log4php/log4php.pkg
new file mode 100644
index 000000000..729b5d124
--- /dev/null
+++ b/libraries/log4php.debug/tutorials/log4php/log4php.pkg
@@ -0,0 +1,28 @@
+<refentry id="{@id}">
+
+  <refnamediv>
+    <refname>Apache log4php</refname>                                                                                                                                                                                                                                                              
+   </refnamediv>  
+ 
+  <refsect1 id="{@id license}">
+    <para>
+        <![CDATA[
+  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.
+       ]]>
+    </para>
+ </refsect1>
+ 
+</refentry>
diff --git a/libraries/log4php.debug/varia/LoggerDenyAllFilter.php b/libraries/log4php.debug/varia/LoggerDenyAllFilter.php
deleted file mode 100644
index ce8699f90..000000000
--- a/libraries/log4php.debug/varia/LoggerDenyAllFilter.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage varia
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/spi/LoggerFilter.php');
-
-/**
- * This filter drops all logging events. 
- * 
- * <p>You can add this filter to the end of a filter chain to
- * switch from the default "accept all unless instructed otherwise"
- * filtering behaviour to a "deny all unless instructed otherwise"
- * behaviour.</p>
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.4 $
- * @package log4php
- * @subpackage varia
- * @since 0.3
- */
-class LoggerDenyAllFilter extends LoggerFilter {
-
-  /**
-   * Always returns the integer constant {@link LOG4PHP_LOGGER_FILTER_DENY}
-   * regardless of the {@link LoggerLoggingEvent} parameter.
-   * 
-   * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to filter.
-   * @return LOG4PHP_LOGGER_FILTER_DENY Always returns {@link LOG4PHP_LOGGER_FILTER_DENY}
-   */
-  function decide($event)
-  {
-    return LOG4PHP_LOGGER_FILTER_DENY;
-  }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/varia/LoggerLevelMatchFilter.php b/libraries/log4php.debug/varia/LoggerLevelMatchFilter.php
deleted file mode 100644
index 2b7af045d..000000000
--- a/libraries/log4php.debug/varia/LoggerLevelMatchFilter.php
+++ /dev/null
@@ -1,119 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage varia
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/helpers/LoggerOptionConverter.php');
-require_once(LOG4PHP_DIR . '/spi/LoggerFilter.php');
-
-/**
- * This is a very simple filter based on level matching.
- *
- * <p>The filter admits two options <b><var>LevelToMatch</var></b> and
- * <b><var>AcceptOnMatch</var></b>. If there is an exact match between the value
- * of the <b><var>LevelToMatch</var></b> option and the level of the 
- * {@link LoggerLoggingEvent}, then the {@link decide()} method returns 
- * {@link LOG4PHP_LOGGER_FILTER_ACCEPT} in case the <b><var>AcceptOnMatch</var></b> 
- * option value is set to <i>true</i>, if it is <i>false</i> then 
- * {@link LOG4PHP_LOGGER_FILTER_DENY} is returned. If there is no match, 
- * {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} is returned.</p>
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.2 $
- * @package log4php
- * @subpackage varia
- * @since 0.6
- */
-class LoggerLevelMatchFilter extends LoggerFilter {
-  
-    /**
-     * @var boolean
-     */
-    var $acceptOnMatch = true;
-
-    /**
-     * @var LoggerLevel
-     */
-    var $levelToMatch;
-  
-    /**
-     * @return boolean
-     */
-    function getAcceptOnMatch()
-    {
-        return $this->acceptOnMatch;
-    }
-    
-    /**
-     * @param boolean $acceptOnMatch
-     */
-    function setAcceptOnMatch($acceptOnMatch)
-    {
-        $this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
-    }
-    
-    /**
-     * @return LoggerLevel
-     */
-    function getLevelToMatch()
-    {
-        return $this->levelToMatch;
-    }
-    
-    /**
-     * @param string $l the level to match
-     */
-    function setLevelToMatch($l)
-    {
-        $this->levelToMatch = LoggerOptionConverter::toLevel($l, null);
-    }
-
-    /**
-     * Return the decision of this filter.
-     * 
-     * Returns {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} if the <b><var>LevelToMatch</var></b>
-     * option is not set or if there is not match.  Otherwise, if there is a
-     * match, then the returned decision is {@link LOG4PHP_LOGGER_FILTER_ACCEPT} if the
-     * <b><var>AcceptOnMatch</var></b> property is set to <i>true</i>. The
-     * returned decision is {@link LOG4PHP_LOGGER_FILTER_DENY} if the
-     * <b><var>AcceptOnMatch</var></b> property is set to <i>false</i>.
-     *
-     * @param LoggerLoggingEvent $event
-     * @return integer
-     */
-    function decide($event)
-    {
-        if($this->levelToMatch === null)
-            return LOG4PHP_LOGGER_FILTER_NEUTRAL;
-        
-        if ($this->levelToMatch->equals($event->getLevel())) {  
-            return $this->getAcceptOnMatch() ? 
-                LOG4PHP_LOGGER_FILTER_ACCEPT : 
-                LOG4PHP_LOGGER_FILTER_DENY;
-        } else {
-            return LOG4PHP_LOGGER_FILTER_NEUTRAL;
-        }
-    }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/varia/LoggerLevelRangeFilter.php b/libraries/log4php.debug/varia/LoggerLevelRangeFilter.php
deleted file mode 100644
index d54beddf3..000000000
--- a/libraries/log4php.debug/varia/LoggerLevelRangeFilter.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage varia
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/helpers/LoggerOptionConverter.php');
-require_once(LOG4PHP_DIR . '/spi/LoggerFilter.php');
-
-/**
- * This is a very simple filter based on level matching, which can be
- * used to reject messages with priorities outside a certain range.
- *  
- * <p>The filter admits three options <b><var>LevelMin</var></b>, <b><var>LevelMax</var></b>
- * and <b><var>AcceptOnMatch</var></b>.</p>
- *
- * <p>If the level of the {@link LoggerLoggingEvent} is not between Min and Max
- * (inclusive), then {@link LOG4PHP_LOGGER_FILTER_DENY} is returned.</p>
- *  
- * <p>If the Logging event level is within the specified range, then if
- * <b><var>AcceptOnMatch</var></b> is <i>true</i>, 
- * {@link LOG4PHP_LOGGER_FILTER_ACCEPT} is returned, and if
- * <b><var>AcceptOnMatch</var></b> is <i>false</i>, 
- * {@link LOG4PHP_LOGGER_FILTER_NEUTRAL} is returned.</p>
- *  
- * <p>If <b><var>LevelMin</var></b> is not defined, then there is no
- * minimum acceptable level (ie a level is never rejected for
- * being too "low"/unimportant).  If <b><var>LevelMax</var></b> is not
- * defined, then there is no maximum acceptable level (ie a
- * level is never rejected for beeing too "high"/important).</p>
- *
- * <p>Refer to the {@link LoggerAppenderSkeleton::setThreshold()} method
- * available to <b>all</b> appenders extending {@link LoggerAppenderSkeleton} 
- * for a more convenient way to filter out events by level.</p>
- *
- * @log4j-class org.apache.log4j.varia.LevelRangeFilter
- * @log4j-author Simon Kitching
- * @log4j-author based on code by Ceki G&uuml;lc&uuml; 
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.2 $
- * @package log4php
- * @subpackage varia
- * @since 0.6
- */
-class LoggerLevelRangeFilter extends LoggerFilter {
-  
-    /**
-     * @var boolean
-     */
-    var $acceptOnMatch = true;
-
-    /**
-     * @var LoggerLevel
-     */
-    var $levelMin;
-  
-    /**
-     * @var LoggerLevel
-     */
-    var $levelMax;
-
-    /**
-     * @return boolean
-     */
-    function getAcceptOnMatch()
-    {
-        return $this->acceptOnMatch;
-    }
-    
-    /**
-     * @param boolean $acceptOnMatch
-     */
-    function setAcceptOnMatch($acceptOnMatch)
-    {
-        $this->acceptOnMatch = LoggerOptionConverter::toBoolean($acceptOnMatch, true); 
-    }
-    
-    /**
-     * @return LoggerLevel
-     */
-    function getLevelMin()
-    {
-        return $this->levelMin;
-    }
-    
-    /**
-     * @param string $l the level min to match
-     */
-    function setLevelMin($l)
-    {
-        $this->levelMin = LoggerOptionConverter::toLevel($l, null);
-    }
-
-    /**
-     * @return LoggerLevel
-     */
-    function getLevelMax()
-    {
-        return $this->levelMax;
-    }
-    
-    /**
-     * @param string $l the level max to match
-     */
-    function setLevelMax($l)
-    {
-        $this->levelMax = LoggerOptionConverter::toLevel($l, null);
-    }
-
-    /**
-     * Return the decision of this filter.
-     *
-     * @param LoggerLoggingEvent $event
-     * @return integer
-     */
-    function decide($event)
-    {
-        $level = $event->getLevel();
-        
-        if($this->levelMin !== null) {
-            if ($level->isGreaterOrEqual($this->levelMin) == false) {
-                // level of event is less than minimum
-                return LOG4PHP_LOGGER_FILTER_DENY;
-            }
-        }
-
-        if($this->levelMax !== null) {
-            if ($level->toInt() > $this->levelMax->toInt()) {
-                // level of event is greater than maximum
-                // Alas, there is no Level.isGreater method. and using
-                // a combo of isGreaterOrEqual && !Equal seems worse than
-                // checking the int values of the level objects..
-                return LOG4PHP_LOGGER_FILTER_DENY;
-            }
-        }
-
-        if ($this->getAcceptOnMatch()) {
-            // this filter set up to bypass later filters and always return
-            // accept if level in range
-            return  LOG4PHP_LOGGER_FILTER_ACCEPT;
-        } else {
-            // event is ok for this filter; allow later filters to have a look..
-            return LOG4PHP_LOGGER_FILTER_NEUTRAL;
-        }
-    }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/varia/LoggerStringMatchFilter.php b/libraries/log4php.debug/varia/LoggerStringMatchFilter.php
deleted file mode 100644
index 9594e89fc..000000000
--- a/libraries/log4php.debug/varia/LoggerStringMatchFilter.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage varia
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-/**
- */
-require_once(LOG4PHP_DIR . '/spi/LoggerFilter.php');
-
-/**
- * This is a very simple filter based on string matching.
- * 
- * <p>The filter admits two options {@link $stringToMatch} and
- * {@link $acceptOnMatch}. If there is a match (using {@link PHP_MANUAL#strpos}
- * between the value of the {@link $stringToMatch} option and the message 
- * of the {@link LoggerLoggingEvent},
- * then the {@link decide()} method returns {@link LOG4PHP_LOGGER_FILTER_ACCEPT} if
- * the <b>AcceptOnMatch</b> option value is true, if it is false then
- * {@link LOG4PHP_LOGGER_FILTER_DENY} is returned. If there is no match, {@link LOG4PHP_LOGGER_FILTER_NEUTRAL}
- * is returned.</p>
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.4 $
- * @package log4php
- * @subpackage varia
- * @since 0.3
- */
-class LoggerStringMatchFilter extends LoggerFilter {
-  
-    /**
-     * @var boolean
-     */
-    var $acceptOnMatch = true;
-
-    /**
-     * @var string
-     */
-    var $stringToMatch = null;
-  
-    /**
-     * @return boolean
-     */
-    function getAcceptOnMatch()
-    {
-        return $this->acceptOnMatch;
-    }
-    
-    /**
-     * @param mixed $acceptOnMatch a boolean or a string ('true' or 'false')
-     */
-    function setAcceptOnMatch($acceptOnMatch)
-    {
-        $this->acceptOnMatch = is_bool($acceptOnMatch) ? 
-            $acceptOnMatch : 
-            (bool)(strtolower($acceptOnMatch) == 'true');
-    }
-    
-    /**
-     * @return string
-     */
-    function getStringToMatch()
-    {
-        return $this->stringToMatch;
-    }
-    
-    /**
-     * @param string $s the string to match
-     */
-    function setStringToMatch($s)
-    {
-        $this->stringToMatch = $s;
-    }
-
-    /**
-     * @return integer a {@link LOGGER_FILTER_NEUTRAL} is there is no string match.
-     */
-    function decide($event)
-    {
-        $msg = $event->getRenderedMessage();
-        
-        if($msg === null or  $this->stringToMatch === null)
-            return LOG4PHP_LOGGER_FILTER_NEUTRAL;
-        if( strpos($msg, $this->stringToMatch) !== false ) {
-            return ($this->acceptOnMatch) ? LOG4PHP_LOGGER_FILTER_ACCEPT : LOG4PHP_LOGGER_FILTER_DENY ; 
-        }
-        return LOG4PHP_LOGGER_FILTER_NEUTRAL;        
-    }
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/xml/LoggerDOMConfigurator.php b/libraries/log4php.debug/xml/LoggerDOMConfigurator.php
deleted file mode 100644
index 333743755..000000000
--- a/libraries/log4php.debug/xml/LoggerDOMConfigurator.php
+++ /dev/null
@@ -1,609 +0,0 @@
-<?php
-/**
- * log4php is a PHP port of the log4j java logging package.
- * 
- * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
- * <p>Design, strategies and part of the methods documentation are developed by log4j team 
- * (Ceki Gülcü as log4j project founder and 
- * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
- *
- * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
- * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
- *
- * <p>This software is published under the terms of the LGPL License
- * a copy of which has been included with this distribution in the LICENSE file.</p>
- * 
- * @package log4php
- * @subpackage xml
- */
-
-/**
- * @ignore 
- */
-if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..');
- 
-require_once(LOG4PHP_DIR . '/helpers/LoggerOptionConverter.php');
-require_once(LOG4PHP_DIR . '/or/LoggerObjectRenderer.php');
-require_once(LOG4PHP_DIR . '/spi/LoggerConfigurator.php');
-require_once(LOG4PHP_DIR . '/LoggerAppender.php');
-require_once(LOG4PHP_DIR . '/LoggerLayout.php');
-require_once(LOG4PHP_DIR . '/LoggerLog.php');
-require_once(LOG4PHP_DIR . '/LoggerManager.php');
-
-define('LOG4PHP_LOGGER_DOM_CONFIGURATOR_APPENDER_STATE',    1000);
-define('LOG4PHP_LOGGER_DOM_CONFIGURATOR_LAYOUT_STATE',      1010);
-define('LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE',        1020);
-define('LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE',      1030);
-define('LOG4PHP_LOGGER_DOM_CONFIGURATOR_FILTER_STATE',      1040);
-
-define('LOG4PHP_LOGGER_DOM_CONFIGURATOR_DEFAULT_FILENAME',  './log4php.xml');
-
-/**
- * @var string the default configuration document
- */
-define('LOG4PHP_LOGGER_DOM_CONFIGURATOR_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
- */
-define('LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS', 'HTTP://WWW.VXR.IT/LOG4PHP/'); 
-
-/**
- * Use this class to initialize the log4php environment using expat parser.
- *
- * <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. As in
- * <pre>
- * &lt;log4php:configuration <b>debug="true"</b> xmlns:log4php="http://www.vxr.it/log4php/">
- * ...
- * &lt;/log4php:configuration>
- * </pre>
- *
- * <p>There are sample XML files included in the package under <b>tests/</b> 
- * subdirectories.</p>
- *
- * @author VxR <vxr@vxr.it>
- * @version $Revision: 1.12 $
- * @package log4php
- * @subpackage xml
- * @since 0.4 
- */
-class LoggerDOMConfigurator extends LoggerConfigurator {
-
-    /**
-     * @var LoggerHierarchy
-     */
-    var $repository;
-    
-    /**
-     * @var array state stack 
-     */
-    var $state;
-
-    /**
-     * @var Logger parsed Logger  
-     */
-    var $logger;
-    
-    /**
-     * @var LoggerAppender parsed LoggerAppender 
-     */
-    var $appender;
-    
-    /**
-     * @var LoggerFilter parsed LoggerFilter 
-     */
-    var $filter;
-    
-    /**
-     * @var LoggerLayout parsed LoggerLayout 
-     */
-    var $layout;
-    
-    /**
-     * Constructor
-     */
-    function LoggerDOMConfigurator()
-    {
-        $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 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
-     * @static
-     */
-    function configure($url = '')
-    {
-        $configurator = new LoggerDOMConfigurator();
-        $repository =& LoggerManager::getLoggerRepository();
-        return $configurator->doConfigure($url, $repository);
-    }
-    
-    /**
-     * 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
-     */
-    function doConfigure($url = '', &$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
-     */
-    function doConfigureByString($xmlData, &$repository)
-    {
-        return $this->parse($xmlData, $repository);
-    }
-    
-    /**
-     * @param LoggerHierarchy &$repository
-     */
-    function doConfigureDefault(&$repository)
-    {
-        return $this->doConfigureByString(LOG4PHP_LOGGER_DOM_CONFIGURATOR_DEFAULT_CONFIGURATION, $repository);
-    }
-    
-    /**
-     * @param string $xmlData
-     */
-    function parse($xmlData, &$repository)
-    {
-        // LoggerManager::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);
-            LoggerLog::warn(
-                "LoggerDOMConfigurator::parse() ".
-                "Parsing error [{$errorCode}] {$errorStr}, line {$errorLine}"
-            );
-            $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
-     */
-    function tagOpen($parser, $tag, $attribs)
-    {
-        switch ($tag) {
-        
-            case 'CONFIGURATION' :
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':CONFIGURATION':
-            
-                LoggerLog::debug("LoggerDOMConfigurator::tagOpen() CONFIGURATION");
-
-                if (isset($attribs['THRESHOLD'])) {
-                
-                    $this->repository->setThreshold(
-                        LoggerOptionConverter::toLevel(
-                            $this->subst($attribs['THRESHOLD']), 
-                            $this->repository->getThreshold()
-                        )
-                    );
-                }
-                if (isset($attribs['DEBUG'])) {
-                    $debug = LoggerOptionConverter::toBoolean($this->subst($attribs['DEBUG']), LoggerLog::internalDebugging());
-                    $this->repository->debug = $debug;
-                    LoggerLog::internalDebugging($debug);
-                    LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LOG4PHP:CONFIGURATION. Internal Debug turned ".($debug ? 'on':'off'));
-                    
-                }
-                break;
-                
-            case 'APPENDER' :
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER':
-            
-                unset($this->appender);
-                $this->appender = null;
-                
-                $name  = $this->subst(@$attribs['NAME']);
-                $class = $this->subst(@$attribs['CLASS']);
-                
-                LoggerLog::debug("LoggerDOMConfigurator::tagOpen():tag=[$tag]:name=[$name]:class=[$class]");
-                
-                $this->appender =& LoggerAppender::singleton($name, $class);
-                if ($this->appender === null) {
-                    LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER cannot instantiate appender '$name'");
-                }
-                $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_APPENDER_STATE;
-                break;
-                
-            case 'APPENDER_REF' :
-            case 'APPENDER-REF' :
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER_REF':
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER-REF':
-            
-            
-                if (isset($attribs['REF']) and !empty($attribs['REF'])) {
-                    $appenderName = $this->subst($attribs['REF']);
-                    
-                    LoggerLog::debug("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref='$appenderName'");        
-                    
-                    $appender =& LoggerAppender::singleton($appenderName);
-                    if ($appender !== null) {
-                        switch (end($this->state)) {
-                            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE:
-                            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE:                
-                                $this->logger->addAppender($appender);
-                                break;
-                        }
-                    } else {
-                        LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref '$appenderName' points to a null appender");
-                    }
-                } else {
-                    LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref not set or empty");            
-                }
-                break;
-                
-            case 'FILTER' :
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':FILTER':
-            
-                LoggerLog::debug("LoggerDOMConfigurator::tagOpen() FILTER");
-                            
-                unset($this->filter);
-                $this->filter = null;
-
-                $filterName = basename($this->subst(@$attribs['CLASS']));
-                if (!empty($filterName)) {
-                    if (!class_exists($filterName)) {
-                        @include_once(LOG4PHP_DIR . "/varia/{$filterName}.php");
-                    }
-                    if (class_exists($filterName)) {
-                        $this->filter = new $filterName();
-                    } else {
-                        LoggerLog::warn("LoggerDOMConfigurator::tagOpen() FILTER. class '$filterName' doesnt exist");
-                    }
-                    $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_FILTER_STATE;
-                } else {
-                    LoggerLog::warn("LoggerDOMConfigurator::tagOpen() FILTER filter name cannot be empty");
-                }
-                break;
-                
-            case 'LAYOUT':
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LAYOUT':
-            
-                $class = @$attribs['CLASS'];
-
-                LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LAYOUT class='{$class}'");
-
-                $this->layout = LoggerLayout::factory($this->subst($class));
-                if ($this->layout === null)
-                    LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LAYOUT unable to instanciate class='{$class}'");
-                
-                $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_LAYOUT_STATE;
-                break;
-            
-            case 'LOGGER':
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_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)) {
-                    LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LOGGER. name='$loggerName'");        
-                    
-                    $class = $this->subst(@$attribs['CLASS']);
-                    if (empty($class)) {
-                        $this->logger =& $this->repository->getLogger($loggerName);
-                    } else {
-                        $className = basename($class);
-                        if (!class_exists($className))  
-                            @include_once("{$class}.php");
-                        if (!class_exists($className)) {
-                            LoggerLog::warn(
-                                "LoggerDOMConfigurator::tagOpen() LOGGER. ".
-                                "cannot find '$className'."
-                            );                        
-                        } else {
-                        
-                            if (in_array('getlogger', get_class_methods($className))) {
-                                $this->logger =& call_user_func(array($className, 'getlogger'), $loggerName);
-                            } else {
-                                LoggerLog::warn(
-                                    "LoggerDOMConfigurator::tagOpen() LOGGER. ".
-                                    "class '$className' doesnt implement 'getLogger()' method."
-                                );                        
-                            }
-                        }
-                    }    
-                    if ($this->logger !== null and isset($attribs['ADDITIVITY'])) {
-                        $additivity = LoggerOptionConverter::toBoolean($this->subst($attribs['ADDITIVITY']), true);     
-                        $this->logger->setAdditivity($additivity);
-                    }
-                } else {
-                    LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LOGGER. Attribute 'name' is not set or is empty.");
-                }
-                $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE;;
-                break;
-            
-            case 'LEVEL':
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LEVEL':
-            case 'PRIORITY':
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':PRIORITY':
-            
-                if (!isset($attribs['VALUE'])) {
-                    LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL value not set");
-                    break;
-                }
-                    
-                LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL value={$attribs['VALUE']}");
-                
-                if ($this->logger === null) { 
-                    LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LEVEL. parent logger is null");
-                    break;
-                }
-        
-                switch (end($this->state)) {
-                    case LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE:
-                        $this->logger->setLevel(
-                            LoggerOptionConverter::toLevel(
-                                $this->subst($attribs['VALUE']), 
-                                $this->logger->getLevel()
-                            )
-                        );
-                        LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL root level is now '{$attribs['VALUE']}' ");                
-                        break;
-                    case LOG4PHP_LOGGER_DOM_CONFIGURATOR_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 LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':PARAM':
-
-                LoggerLog::debug("LoggerDOMConfigurator::tagOpen() PARAM");
-                
-                if (!isset($attribs['NAME'])) {
-                    LoggerLog::warn(
-                        "LoggerDOMConfigurator::tagOpen() PARAM. ".
-                        "attribute 'name' not defined."
-                    );
-                    break;
-                }
-                if (!isset($attribs['VALUE'])) {
-                    LoggerLog::warn(
-                        "LoggerDOMConfigurator::tagOpen() PARAM. ".
-                        "attribute 'value' not defined."
-                    );
-                    break;
-                }
-                    
-                switch (end($this->state)) {
-                    case LOG4PHP_LOGGER_DOM_CONFIGURATOR_APPENDER_STATE:
-                        if ($this->appender !== null) {
-                            $this->setter($this->appender, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
-                        } else {
-                            LoggerLog::warn(
-                                "LoggerDOMConfigurator::tagOpen() PARAM. ".
-                                " trying to set property to a null appender."
-                            );
-                        }
-                        break;
-                    case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LAYOUT_STATE:
-                        if ($this->layout !== null) {
-                            $this->setter($this->layout, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));                
-                        } else {
-                            LoggerLog::warn(
-                                "LoggerDOMConfigurator::tagOpen() PARAM. ".
-                                " trying to set property to a null layout."
-                            );
-                        }
-                        break;
-                    case LOG4PHP_LOGGER_DOM_CONFIGURATOR_FILTER_STATE:
-                        if ($this->filter !== null) {
-                            $this->setter($this->filter, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
-                        } else {
-                            LoggerLog::warn(
-                                "LoggerDOMConfigurator::tagOpen() PARAM. ".
-                                " trying to set property to a null filter."
-                            );
-                        }
-                        break;
-                    default:
-                        LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM state '{$this->state}' not allowed here");
-                }
-                break;
-            
-            case 'RENDERER':
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':RENDERER':
-
-                $renderedClass   = $this->subst(@$attribs['RENDEREDCLASS']);
-                $renderingClass  = $this->subst(@$attribs['RENDERINGCLASS']);
-        
-                LoggerLog::debug("LoggerDOMConfigurator::tagOpen() RENDERER renderedClass='$renderedClass' renderingClass='$renderingClass'");
-        
-                if (!empty($renderedClass) and !empty($renderingClass)) {
-                    $renderer = LoggerObjectRenderer::factory($renderingClass);
-                    if ($renderer === null) {
-                        LoggerLog::warn("LoggerDOMConfigurator::tagOpen() RENDERER cannot instantiate '$renderingClass'");
-                    } else { 
-                        $this->repository->setRenderer($renderedClass, $renderer);
-                    }
-                } else {
-                    LoggerLog::warn("LoggerDOMConfigurator::tagOpen() RENDERER renderedClass or renderingClass is empty");        
-                }
-                break;
-            
-            case 'ROOT':
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':ROOT':
-            
-                LoggerLog::debug("LoggerDOMConfigurator::tagOpen() ROOT");
-                
-                $this->logger =& LoggerManager::getRootLogger();
-                
-                $this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE;
-                break;
-                
-        }
-         
-    }
-
-
-    /**
-     * @param mixed $parser
-     * @param string $tag
-     */
-    function tagClose($parser, $tag)
-    {
-        switch ($tag) {
-        
-            case 'CONFIGURATION' : 
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':CONFIGURATION':
-          
-                LoggerLog::debug("LoggerDOMConfigurator::tagClose() CONFIGURATION");
-                break;
-                
-            case 'APPENDER' :
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':APPENDER':
-            
-                LoggerLog::debug("LoggerDOMConfigurator::tagClose() APPENDER");
-                
-                if ($this->appender !== null) {
-                    if ($this->appender->requiresLayout() and $this->appender->layout === null) {
-                        $appenderName = $this->appender->getName();
-                        LoggerLog::warn(
-                            "LoggerDOMConfigurator::tagClose() APPENDER. ".
-                            "'$appenderName' requires a layout that is not defined. ".
-                            "Using a simple layout"
-                        );
-                        $this->appender->setLayout(LoggerLayout::factory('LoggerLayoutSimple'));
-                    }                    
-                    $this->appender->activateOptions();
-                }        
-                array_pop($this->state);        
-                break;
-                
-            case 'FILTER' :
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':FILTER':
-            
-                LoggerLog::debug("LoggerDOMConfigurator::tagClose() FILTER");
-                            
-                if ($this->filter !== null) {
-                    $this->filter->activateOptions();
-                    $this->appender->addFilter($this->filter);
-                    $this->filter = null;
-                }
-                array_pop($this->state);        
-                break;
-                
-            case 'LAYOUT':
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LAYOUT':
-
-                LoggerLog::debug("LoggerDOMConfigurator::tagClose() 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 LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':LOGGER':
-            
-                LoggerLog::debug("LoggerDOMConfigurator::tagClose() LOGGER");        
-
-                array_pop($this->state);
-                break;
-            
-            case 'ROOT':
-            case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS.':ROOT':
-            
-                LoggerLog::debug("LoggerDOMConfigurator::tagClose() ROOT");
-
-                array_pop($this->state);
-                break;
-        }
-    }
-    
-    /**
-     * @param object $object
-     * @param string $name
-     * @param mixed $value
-     */
-    function setter(&$object, $name, $value)
-    {
-        if (empty($name)) {
-            LoggerLog::debug("LoggerDOMConfigurator::setter() 'name' param cannot be empty");        
-            return false;
-        }
-        $methodName = 'set'.ucfirst($name);
-        if (method_exists($object, $methodName)) {
-            LoggerLog::debug("LoggerDOMConfigurator::setter() Calling ".get_class($object)."::{$methodName}({$value})");
-            return call_user_func(array(&$object, $methodName), $value);
-        } else {
-            LoggerLog::warn("LoggerDOMConfigurator::setter() ".get_class($object)."::{$methodName}() does not exists");
-            return false;
-        }
-    }
-    
-    function subst($value)
-    {
-        return LoggerOptionConverter::substVars($value);
-    }
-
-}
-?>
\ No newline at end of file
diff --git a/libraries/log4php.debug/xml/log4php.dtd b/libraries/log4php.debug/xml/log4php.dtd
new file mode 100644
index 000000000..17f31ff30
--- /dev/null
+++ b/libraries/log4php.debug/xml/log4php.dtd
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+ -->
+<!-- Authors: Chris Taylor, Ceki Gülcü. -->
+<!-- Version: 1.2 -->
+
+<!-- PHP Port Modifications Author: Marco Vassura -->
+<!-- PHP dtd Version: $Revision: 823875 $ -->
+
+<!-- A configuration element consists of optional renderer
+elements,appender elements, categories and an optional root
+element. -->
+<!-- [log4php] -->
+<!--
+    category instead of logger cannot be used. categoryFactory is not implemented in log4php.
+-->
+<!-- [/log4php] -->
+<!ELEMENT log4php:configuration (renderer*, appender*,(logger)*,root?)>
+
+<!-- The "threshold" attribute takes a level value such that all -->
+<!-- logging statements with a level equal or below this value are -->
+<!-- disabled. -->
+
+<!-- Setting the "debug" enable the printing of internal log4j logging   -->
+<!-- statements.                                                         -->
+
+<!-- By default, debug attribute is "null", meaning that we not do touch -->
+<!-- internal log4j logging settings. The "null" value for the threshold -->
+<!-- attribute can be misleading. The threshold field of a repository    -->
+<!-- cannot be set to null. The "null" value for the threshold attribute -->
+<!-- simply means don't touch the threshold field, the threshold field   --> 
+<!-- keeps its old value.                                                -->
+     
+<!ATTLIST log4php:configuration
+  xmlns:log4php            CDATA #FIXED "http://logging.apache.org/log4php"
+  threshold                (all|debug|info|warn|error|fatal|off|null) "null"
+>
+
+<!-- renderer elements allow the user to customize the conversion of  -->
+<!-- message objects to String.                                       -->
+<!ELEMENT renderer EMPTY>
+<!ATTLIST renderer
+    renderedClass  CDATA #REQUIRED
+    renderingClass CDATA #REQUIRED
+>
+
+<!-- Appenders must have a name and a class. -->
+<!-- Appenders may contain an error handler, a layout, optional parameters -->
+<!-- and filters. They may also reference (or include) other appenders. -->
+<!-- [log4php] -->
+<!-- error handler tag has no effects since log4php does not handle errors. Defintion deleted. -->
+<!-- [/log4php] -->
+<!ELEMENT appender (param*, layout?, filter*, appender-ref*)>
+<!ATTLIST appender
+  name      ID  #REQUIRED
+  class     CDATA   #REQUIRED
+>
+
+<!ELEMENT layout (param*)>
+<!ATTLIST layout
+  class     CDATA   #REQUIRED
+>
+
+<!ELEMENT filter (param*)>
+<!ATTLIST filter
+  class     CDATA   #REQUIRED
+>
+
+
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+  name      CDATA   #REQUIRED
+  value     CDATA   #REQUIRED
+>
+
+<!ELEMENT priority EMPTY>
+<!ATTLIST priority
+  value   CDATA #REQUIRED
+>
+
+<!ELEMENT level EMPTY>
+<!ATTLIST level
+  value   CDATA #REQUIRED
+>
+
+<!-- If no level element is specified, then the configurator MUST not -->
+<!-- touch the level of the named logger. -->
+<!ELEMENT logger (level?,appender-ref*)>
+<!ATTLIST logger
+  name      ID  #REQUIRED
+  additivity    (true|false) "true"  
+>
+
+<!ELEMENT appender-ref EMPTY>
+<!ATTLIST appender-ref
+  ref IDREF #REQUIRED
+>
+
+<!-- If no priority element is specified, then the configurator MUST not -->
+<!-- touch the priority of root. -->
+<!-- The root category always exists and cannot be subclassed. -->
+<!ELEMENT root (param*, (priority|level)?, appender-ref*)>
+
+
+<!-- ==================================================================== -->
+<!--                       A logging event                                -->
+<!-- ==================================================================== -->
+<!ELEMENT log4php:eventSet (log4php:event*)>
+<!ATTLIST log4php:eventSet
+  xmlns:log4php          CDATA #FIXED "http://www.vxr.it/log4php/" 
+  version                (0.2|0.3) "0.3" 
+  includesLocationInfo   (true|false) "true"
+>
+
+<!ELEMENT log4php:event (log4php:message, log4php:locationInfo?) >
+
+<!-- The timestamp format is application dependent. -->
+<!ATTLIST log4php:event
+    logger     CDATA #REQUIRED
+    level      CDATA #REQUIRED
+    thread     CDATA #REQUIRED
+    timestamp  CDATA #REQUIRED
+>
+
+<!ELEMENT log4php:message (#PCDATA)>
+<!ELEMENT log4php:NDC (#PCDATA)>
+
+<!ELEMENT log4php:locationInfo EMPTY>
+<!ATTLIST log4php:locationInfo
+  class  CDATA  #REQUIRED
+  method CDATA  #REQUIRED
+  file   CDATA  #REQUIRED
+  line   CDATA  #REQUIRED
+>
diff --git a/libraries/nusoap/nusoap.php b/libraries/nusoap/nusoap.php
index ca18d858a..b9ddd7a64 100644
--- a/libraries/nusoap/nusoap.php
+++ b/libraries/nusoap/nusoap.php
@@ -59,7 +59,7 @@ if (!isset($GLOBALS['_transient']['static']['nusoap_base'])) {
 
 $GLOBALS['_transient']['static']['nusoap_base']->globalDebugLevel = 9;
 global $soap_log;
-$soap_log = LoggerManager::getLogger('SOAP');
+$soap_log = Logger::getLogger('SOAP');
 /**
 *
 * nusoap_base
diff --git a/modules/Accounts/Accounts.php b/modules/Accounts/Accounts.php
index 80b094869..95c228518 100644
--- a/modules/Accounts/Accounts.php
+++ b/modules/Accounts/Accounts.php
@@ -104,7 +104,7 @@ class Accounts extends CRMEntity {
 	);
         function __construct()
         {
-            $this->log =LoggerManager::getLogger('account');
+            $this->log =Logger::getLogger('account');
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Accounts');
         }
diff --git a/modules/Calendar/Activity.php b/modules/Calendar/Activity.php
index 5ebf5fe05..3a0cd7320 100644
--- a/modules/Calendar/Activity.php
+++ b/modules/Calendar/Activity.php
@@ -105,7 +105,7 @@ class Activity extends CRMEntity {
 	//var $groupTable = Array('vtiger_activitygrouprelation','activityid');
         function __construct()
         {
-            $this->log = LoggerManager::getLogger('Calendar');
+            $this->log = Logger::getLogger('Calendar');
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Calendar');
         }
diff --git a/modules/Campaigns/Campaigns.php b/modules/Campaigns/Campaigns.php
index ef6d8ba5f..468aef68c 100644
--- a/modules/Campaigns/Campaigns.php
+++ b/modules/Campaigns/Campaigns.php
@@ -69,7 +69,7 @@ class Campaigns extends CRMEntity {
 	// For Alphabetical search
 	var $def_basicsearch_col = 'campaignname';
         function __construct() {
-            $this->log =LoggerManager::getLogger('campaign');
+            $this->log =Logger::getLogger('campaign');
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Campaigns');
         }   
diff --git a/modules/Contacts/Contacts.php b/modules/Contacts/Contacts.php
index 68f72ce4f..fe9342546 100644
--- a/modules/Contacts/Contacts.php
+++ b/modules/Contacts/Contacts.php
@@ -145,7 +145,7 @@ class Contacts extends CRMEntity {
         'Vendors' => array('table_name' => 'vtiger_vendorcontactrel', 'table_index' => 'vendorid', 'rel_index' => 'contactid'),
 	);
         function __construct() {
-            $this->log = LoggerManager::getLogger('contact');
+            $this->log = Logger::getLogger('contact');
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Contacts');
         }       
diff --git a/modules/CustomView/ListViewTop.php b/modules/CustomView/ListViewTop.php
index f676baa60..3b877aa06 100644
--- a/modules/CustomView/ListViewTop.php
+++ b/modules/CustomView/ListViewTop.php
@@ -60,7 +60,7 @@ function getKeyMetrics($maxval,$calCnt)
 	$metricviewnames = "'Hot Leads'";
 
 	$current_module_strings = return_module_language($current_language, "CustomView");
-	$log = LoggerManager::getLogger('metrics');
+	$log = Logger::getLogger('metrics');
 
 	$metriclists = getMetricList();
 	
diff --git a/modules/Documents/Documents.php b/modules/Documents/Documents.php
index c4060c926..646781b37 100644
--- a/modules/Documents/Documents.php
+++ b/modules/Documents/Documents.php
@@ -72,7 +72,7 @@ class Documents extends CRMEntity {
 	var $default_sort_order = 'ASC';
         
         function __construct() {
-            $this->log = LoggerManager::getLogger('notes');
+            $this->log = Logger::getLogger('notes');
             $this->log->debug("Entering Documents() method ...");
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Documents');
diff --git a/modules/Emails/Emails.php b/modules/Emails/Emails.php
index 1a552f8bd..5fc89cf0d 100644
--- a/modules/Emails/Emails.php
+++ b/modules/Emails/Emails.php
@@ -68,9 +68,9 @@ class Emails extends CRMEntity {
 	/** This function will set the columnfields for Email module
 	 */
         function __construct() {
-            $this->log = LoggerManager::getLogger('email');
+            $this->log = Logger::getLogger('email');
             $this->log->debug("Entering Emails() method ...");
-            $this->log = LoggerManager::getLogger('email');
+            $this->log = Logger::getLogger('email');
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Emails');
             $this->log->debug("Exiting Email method ...");
diff --git a/modules/Faq/Faq.php b/modules/Faq/Faq.php
index 3cbd5f538..e5867d0a6 100755
--- a/modules/Faq/Faq.php
+++ b/modules/Faq/Faq.php
@@ -80,7 +80,7 @@ class Faq extends CRMEntity {
 	/**	Constructor which will set the column_fields in this object
 	 */
         function __construct() {
-            $this->log =LoggerManager::getLogger('faq');
+            $this->log =Logger::getLogger('faq');
             $this->log->debug("Entering Faq() method ...");
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Faq');
diff --git a/modules/HelpDesk/HelpDesk.php b/modules/HelpDesk/HelpDesk.php
index bea2dfdab..e1981f844 100644
--- a/modules/HelpDesk/HelpDesk.php
+++ b/modules/HelpDesk/HelpDesk.php
@@ -101,7 +101,7 @@ class HelpDesk extends CRMEntity {
 	/**	Constructor which will set the column_fields in this object
 	 */
         function __construct() {
-            $this->log =LoggerManager::getLogger('helpdesk');
+            $this->log =Logger::getLogger('helpdesk');
             $this->log->debug("Entering HelpDesk() method ...");
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('HelpDesk');
diff --git a/modules/Invoice/Invoice.php b/modules/Invoice/Invoice.php
index 46f8f255f..48463a0bf 100755
--- a/modules/Invoice/Invoice.php
+++ b/modules/Invoice/Invoice.php
@@ -105,7 +105,7 @@ class Invoice extends CRMEntity {
 	/**	Constructor which will set the column_fields in this object
 	 */
         function __construct() {
-            $this->log =LoggerManager::getLogger('Invoice');
+            $this->log =Logger::getLogger('Invoice');
             $this->log->debug("Entering Invoice() method ...");
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Invoice');
diff --git a/modules/Leads/Leads.php b/modules/Leads/Leads.php
index 25f47856a..72882ec8d 100755
--- a/modules/Leads/Leads.php
+++ b/modules/Leads/Leads.php
@@ -86,7 +86,7 @@ class Leads extends CRMEntity {
 	//var $groupTable = Array('vtiger_leadgrouprelation','leadid');
 
         function __construct() {
-            $this->log = LoggerManager::getLogger('lead');
+            $this->log = Logger::getLogger('lead');
             $this->log->debug("Entering Leads() method ...");
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Leads');
diff --git a/modules/Potentials/Potentials.php b/modules/Potentials/Potentials.php
index 96e1f9a9c..76108adab 100644
--- a/modules/Potentials/Potentials.php
+++ b/modules/Potentials/Potentials.php
@@ -93,7 +93,7 @@ class Potentials extends CRMEntity {
 	var $LBL_POTENTIAL_MAPPING = 'LBL_OPPORTUNITY_MAPPING';
 	//var $groupTable = Array('vtiger_potentialgrouprelation','potentialid');
 	function __construct() {
-            $this->log = LoggerManager::getLogger('potential');
+            $this->log = Logger::getLogger('potential');
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Potentials');
         }   
diff --git a/modules/PriceBooks/PriceBooks.php b/modules/PriceBooks/PriceBooks.php
index 06d5e6d20..269e22d4a 100755
--- a/modules/PriceBooks/PriceBooks.php
+++ b/modules/PriceBooks/PriceBooks.php
@@ -55,7 +55,7 @@ class PriceBooks extends CRMEntity {
 	/**	Constructor which will set the column_fields in this object
 	 */
         function __construct() {
-            $this->log =LoggerManager::getLogger('pricebook');
+            $this->log =Logger::getLogger('pricebook');
             $this->log->debug("Entering PriceBooks() method ...");
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('PriceBooks');
diff --git a/modules/Products/Products.php b/modules/Products/Products.php
index 4ea28bde2..386a2da03 100755
--- a/modules/Products/Products.php
+++ b/modules/Products/Products.php
@@ -74,7 +74,7 @@ class Products extends CRMEntity {
 	/**	Constructor which will set the column_fields in this object
 	 */
         function __construct() {
-            $this->log =LoggerManager::getLogger('product');
+            $this->log =Logger::getLogger('product');
             $this->log->debug("Entering Products() method ...");
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Products');
diff --git a/modules/PurchaseOrder/PurchaseOrder.php b/modules/PurchaseOrder/PurchaseOrder.php
index 452e3510f..625bcfb62 100644
--- a/modules/PurchaseOrder/PurchaseOrder.php
+++ b/modules/PurchaseOrder/PurchaseOrder.php
@@ -98,7 +98,7 @@ class PurchaseOrder extends CRMEntity {
 	 *  creates an instance for PearDatabase class and get values for column_fields array of Order class.
 	 */
         function __construct() {
-            $this->log =LoggerManager::getLogger('PurchaseOrder');
+            $this->log =Logger::getLogger('PurchaseOrder');
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('PurchaseOrder');
         }
diff --git a/modules/Quotes/Quotes.php b/modules/Quotes/Quotes.php
index 19089618a..86056c5aa 100755
--- a/modules/Quotes/Quotes.php
+++ b/modules/Quotes/Quotes.php
@@ -105,7 +105,7 @@ class Quotes extends CRMEntity {
 	/**	Constructor which will set the column_fields in this object
 	 */
         function __construct() {
-            $this->log =LoggerManager::getLogger('quote');
+            $this->log =Logger::getLogger('quote');
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Quotes');
         }
diff --git a/modules/Reports/ReportSharing.php b/modules/Reports/ReportSharing.php
index e29a00f3c..b0d4375cc 100644
--- a/modules/Reports/ReportSharing.php
+++ b/modules/Reports/ReportSharing.php
@@ -21,7 +21,7 @@ $current_module_strings = return_module_language($current_language, 'Reports');
 global $list_max_entries_per_page;
 global $urlPrefix;
 
-$log = LoggerManager::getLogger('report_type');
+$log = Logger::getLogger('report_type');
 global $currentModule;
 global $image_path;
 global $theme;
diff --git a/modules/Reports/ReportType.php b/modules/Reports/ReportType.php
index bf5473d6d..0e14e9fc8 100644
--- a/modules/Reports/ReportType.php
+++ b/modules/Reports/ReportType.php
@@ -21,7 +21,7 @@ $current_module_strings = return_module_language($current_language, 'Reports');
 global $list_max_entries_per_page;
 global $urlPrefix;
 
-$log = LoggerManager::getLogger('report_type');
+$log = Logger::getLogger('report_type');
 
 global $currentModule;
 global $image_path;
diff --git a/modules/SalesOrder/SalesOrder.php b/modules/SalesOrder/SalesOrder.php
index 4e20c2ac8..28091881a 100644
--- a/modules/SalesOrder/SalesOrder.php
+++ b/modules/SalesOrder/SalesOrder.php
@@ -107,7 +107,7 @@ class SalesOrder extends CRMEntity {
 	 *  creates an instance for PearDatabase class and get values for column_fields array of SalesOrder class.
 	 */
         function __construct() {
-            $this->log =LoggerManager::getLogger('SalesOrder');
+            $this->log =Logger::getLogger('SalesOrder');
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('SalesOrder');
         }
diff --git a/modules/Users/DefaultDataPopulator.php b/modules/Users/DefaultDataPopulator.php
index 4afad7858..88736e4f6 100644
--- a/modules/Users/DefaultDataPopulator.php
+++ b/modules/Users/DefaultDataPopulator.php
@@ -18,7 +18,7 @@ require_once('include/utils/utils.php');
 class DefaultDataPopulator extends CRMEntity {
 
         function __construct() {
-            $this->log = LoggerManager::getLogger('DefaultDataPopulator');
+            $this->log = Logger::getLogger('DefaultDataPopulator');
             $this->db = PearDatabase::getInstance();
         }
 	function DefaultDataPopulator() {
diff --git a/modules/Users/Users.php b/modules/Users/Users.php
index 232ad18e8..6ddb8206d 100755
--- a/modules/Users/Users.php
+++ b/modules/Users/Users.php
@@ -133,7 +133,7 @@ class Users extends CRMEntity {
 	 *
 	 */
         function __construct() {
-            $this->log = LoggerManager::getLogger('user');
+            $this->log = Logger::getLogger('user');
             $this->log->debug("Entering Users() method ...");
             $this->db = PearDatabase::getInstance();
             $this->DEFAULT_PASSWORD_CRYPT_TYPE = (version_compare(PHP_VERSION, '5.3.0') >= 0)? 'PHP5.3MD5': 'MD5';
diff --git a/modules/Vendors/Vendors.php b/modules/Vendors/Vendors.php
index e9cd0c16b..abe9b79d2 100755
--- a/modules/Vendors/Vendors.php
+++ b/modules/Vendors/Vendors.php
@@ -65,7 +65,7 @@ class Vendors extends CRMEntity {
 	/**	Constructor which will set the column_fields in this object
 	 */
         function __construct() {
-            $this->log =LoggerManager::getLogger('vendor');
+            $this->log =Logger::getLogger('vendor');
             $this->log->debug("Entering Vendors() method ...");
             $this->db = PearDatabase::getInstance();
             $this->column_fields = getColumnFields('Vendors');
diff --git a/modules/Vtiger/layout_utils.php b/modules/Vtiger/layout_utils.php
index 905b62576..f65fff9fc 100644
--- a/modules/Vtiger/layout_utils.php
+++ b/modules/Vtiger/layout_utils.php
@@ -22,7 +22,7 @@
 require_once('include/logging.php');
 global $app_strings;
 
-$log = LoggerManager::getLogger('layout_utils');	
+$log = Logger::getLogger('layout_utils');	
 
 /**
  * Create HTML to display formatted form title of a form in the left pane
diff --git a/webservice.php b/webservice.php
index 98dfa1e02..5dd254b90 100644
--- a/webservice.php
+++ b/webservice.php
@@ -34,8 +34,8 @@
 	$API_VERSION = "0.22";
 
 	global $seclog,$log;
-	$seclog =& LoggerManager::getLogger('SECURITY');
-	$log =& LoggerManager::getLogger('webservice');
+	$seclog = Logger::getLogger('SECURITY');
+	$log = Logger::getLogger('webservice');
 
 	function getRequestParamsArrayForOperation($operation){
 		global $operationInput;
-- 
GitLab