You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ih...@apache.org on 2013/11/28 17:03:50 UTC

[20/43] LOG4PHP-121: Reorganized classes into namespaces

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/appenders/LoggerAppenderMongoDB.php
----------------------------------------------------------------------
diff --git a/src/main/php/appenders/LoggerAppenderMongoDB.php b/src/main/php/appenders/LoggerAppenderMongoDB.php
deleted file mode 100644
index c0f2c2d..0000000
--- a/src/main/php/appenders/LoggerAppenderMongoDB.php
+++ /dev/null
@@ -1,360 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
-/**
- * Appender for writing to MongoDB.
- * 
- * This class was originally contributed by Vladimir Gorej.
- * 
- * ## Configurable parameters: ##
- * 
- * - **host** - Server on which mongodb instance is located. 
- * - **port** - Port on which the instance is bound.
- * - **databaseName** - Name of the database to which to log.
- * - **collectionName** - Name of the target collection within the given database.
- * - **username** - Username used to connect to the database.
- * - **password** - Password used to connect to the database.
- * - **timeout** - For how long the driver should try to connect to the database (in milliseconds).
- * 
- * @version $Revision$
- * @package log4php
- * @subpackage appenders
- * @since 2.1
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/mongodb.html Appender documentation
- * @link http://github.com/log4mongo/log4mongo-php Vladimir Gorej's original submission.
- * @link http://www.mongodb.org/ MongoDB website.
- */
-class LoggerAppenderMongoDB extends LoggerAppender {
-	
-	// ******************************************
-	// ** Constants                            **
-	// ******************************************
-	
-	/** Default prefix for the {@link $host}. */	
-	const DEFAULT_MONGO_URL_PREFIX = 'mongodb://';
-	
-	/** Default value for {@link $host}, without a prefix. */
-	const DEFAULT_MONGO_HOST = 'localhost';
-	
-	/** Default value for {@link $port} */
-	const DEFAULT_MONGO_PORT = 27017;
-	
-	/** Default value for {@link $databaseName} */
-	const DEFAULT_DB_NAME = 'log4php_mongodb';
-	
-	/** Default value for {@link $collectionName} */
-	const DEFAULT_COLLECTION_NAME = 'logs';
-	
-	/** Default value for {@link $timeout} */
-	const DEFAULT_TIMEOUT_VALUE = 3000;
-	
-	// ******************************************
-	// ** Configurable parameters              **
-	// ******************************************
-	
-	/** Server on which mongodb instance is located. */
-	protected $host;
-	
-	/** Port on which the instance is bound. */
-	protected $port;
-	
-	/** Name of the database to which to log. */
-	protected $databaseName;
-	
-	/** Name of the collection within the given database. */
-	protected $collectionName;
-			
-	/** Username used to connect to the database. */
-	protected $userName;
-	
-	/** Password used to connect to the database. */
-	protected $password;
-	
-	/** Timeout value used when connecting to the database (in milliseconds). */
-	protected $timeout;
-	
-	// ******************************************
-	// ** Member variables                     **
-	// ******************************************
-
-	/** 
-	 * Connection to the MongoDB instance.
-	 * @var Mongo
-	 */
-	protected $connection;
-	
-	/** 
-	 * The collection to which log is written. 
-	 * @var MongoCollection
-	 */
-	protected $collection;
-
-	public function __construct($name = '') {
-		parent::__construct($name);
-		$this->host = self::DEFAULT_MONGO_URL_PREFIX . self::DEFAULT_MONGO_HOST;
-		$this->port = self::DEFAULT_MONGO_PORT;
-		$this->databaseName = self::DEFAULT_DB_NAME;
-		$this->collectionName = self::DEFAULT_COLLECTION_NAME;
-		$this->timeout = self::DEFAULT_TIMEOUT_VALUE;
-		$this->requiresLayout = false;
-	}
-	
-	/**
-	 * Setup db connection.
-	 * Based on defined options, this method connects to the database and 
-	 * creates a {@link $collection}. 
-	 */
-	public function activateOptions() {
-		try {
-			$this->connection = new Mongo(sprintf('%s:%d', $this->host, $this->port), array('timeout' => $this->timeout));
-			$db	= $this->connection->selectDB($this->databaseName);
-			if ($this->userName !== null && $this->password !== null) {
-				$authResult = $db->authenticate($this->userName, $this->password);
-				if ($authResult['ok'] == floatval(0)) {
-					throw new Exception($authResult['errmsg'], $authResult['ok']);
-				}
-			}
-			$this->collection = $db->selectCollection($this->collectionName);
-		} catch (MongoConnectionException $ex) {
-			$this->closed = true;
-			$this->warn(sprintf('Failed to connect to mongo deamon: %s', $ex->getMessage()));
-		} catch (InvalidArgumentException $ex) {
-			$this->closed = true;
-			$this->warn(sprintf('Error while selecting mongo database: %s', $ex->getMessage()));
-		} catch (Exception $ex) {
-			$this->closed = true;
-			$this->warn('Invalid credentials for mongo database authentication');
-		}
-	}
-
-	/**
-	 * Appends a new event to the mongo database.
-	 *
-	 * @param LoggerLoggingEvent $event
-	 */
-	public function append(LoggerLoggingEvent $event) {
-		try {
-			if ($this->collection != null) {
-				$this->collection->insert($this->format($event));
-			}
-		} catch (MongoCursorException $ex) {
-			$this->warn(sprintf('Error while writing to mongo collection: %s', $ex->getMessage()));
-		}
-	}
-	
-	/**
-	 * Converts the logging event into an array which can be logged to mongodb.
-	 * 
-	 * @param LoggerLoggingEvent $event
-	 * @return array The array representation of the logging event.
-	 */
-	protected function format(LoggerLoggingEvent $event) {
-		$timestampSec = (int) $event->getTimestamp();
-		$timestampUsec = (int) (($event->getTimestamp() - $timestampSec) * 1000000);
-
-		$document = array(
-			'timestamp' => new MongoDate($timestampSec, $timestampUsec),
-			'level' => $event->getLevel()->toString(),
-			'thread' => (int) $event->getThreadName(),
-			'message' => $event->getMessage(),
-			'loggerName' => $event->getLoggerName() 
-		);	
-
-		$locationInfo = $event->getLocationInformation();
-		if ($locationInfo != null) {
-			$document['fileName'] = $locationInfo->getFileName();
-			$document['method'] = $locationInfo->getMethodName();
-			$document['lineNumber'] = ($locationInfo->getLineNumber() == 'NA') ? 'NA' : (int) $locationInfo->getLineNumber();
-			$document['className'] = $locationInfo->getClassName();
-		}	
-
-		$throwableInfo = $event->getThrowableInformation();
-		if ($throwableInfo != null) {
-			$document['exception'] = $this->formatThrowable($throwableInfo->getThrowable());
-		}
-		
-		return $document;
-	}
-	
-	/**
-	 * Converts an Exception into an array which can be logged to mongodb.
-	 * 
-	 * Supports innner exceptions (PHP >= 5.3)
-	 * 
-	 * @param Exception $ex
-	 * @return array
-	 */
-	protected function formatThrowable(Exception $ex) {
-		$array = array(				
-			'message' => $ex->getMessage(),
-			'code' => $ex->getCode(),
-			'stackTrace' => $ex->getTraceAsString(),
-		);
-        
-		if (method_exists($ex, 'getPrevious') && $ex->getPrevious() !== null) {
-			$array['innerException'] = $this->formatThrowable($ex->getPrevious());
-		}
-		
-		return $array;
-	}
-		
-	/**
-	 * Closes the connection to the logging database
-	 */
-	public function close() {
-		if($this->closed != true) {
-			$this->collection = null;
-			if ($this->connection !== null) {
-				$this->connection->close();
-				$this->connection = null;
-			}
-			$this->closed = true;
-		}
-	}
-	
-	/** 
-	 * Sets the value of {@link $host} parameter.
-	 * @param string $host
-	 */
-	public function setHost($host) {
-		if (!preg_match('/^mongodb\:\/\//', $host)) {
-			$host = self::DEFAULT_MONGO_URL_PREFIX . $host;
-		}
-		$this->host = $host;
-	}
-		
-	/** 
-	 * Returns the value of {@link $host} parameter.
-	 * @return string
-	 */
-	public function getHost() {
-		return $this->host;
-	}
-
-	/** 
-	 * Sets the value of {@link $port} parameter.
-	 * @param int $port
-	 */
-	public function setPort($port) {
-		$this->setPositiveInteger('port', $port);
-	}
-		
-	/** 
-	 * Returns the value of {@link $port} parameter.
-	 * @return int
-	 */
-	public function getPort() {
-		return $this->port;
-	}
-
-	/** 
-	 * Sets the value of {@link $databaseName} parameter.
-	 * @param string $databaseName
-	 */
-	public function setDatabaseName($databaseName) {
-		$this->setString('databaseName', $databaseName);
-	}
-		
-	/** 
-	 * Returns the value of {@link $databaseName} parameter.
-	 * @return string
-	 */
-	public function getDatabaseName() {
-		return $this->databaseName;
-	}
-
-	/** 
-	 * Sets the value of {@link $collectionName} parameter.
-	 * @param string $collectionName
-	 */
-	public function setCollectionName($collectionName) {
-		$this->setString('collectionName', $collectionName);
-	}
-		
-	/** 
-	 * Returns the value of {@link $collectionName} parameter.
-	 * @return string
-	 */
-	public function getCollectionName() {
-		return $this->collectionName;
-	}
-
-	/** 
-	 * Sets the value of {@link $userName} parameter.
-	 * @param string $userName
-	 */
-	public function setUserName($userName) {
-		$this->setString('userName', $userName, true);
-	}
-	
-	/** 
-	 * Returns the value of {@link $userName} parameter.
-	 * @return string
-	 */
-	public function getUserName() {
-		return $this->userName;
-	}
-
-	/** 
-	 * Sets the value of {@link $password} parameter.
-	 * @param string $password
-	 */
-	public function setPassword($password) {
-		$this->setString('password', $password, true);
-	}
-		
-	/** 
-	 * Returns the value of {@link $password} parameter.
-	 * @return string 
-	 */
-	public function getPassword() {
-		return $this->password;
-	}
-
-	/** 
-	 * Sets the value of {@link $timeout} parameter.
-	 * @param int $timeout
-	 */
-	public function setTimeout($timeout) {
-		$this->setPositiveInteger('timeout', $timeout);
-	}
-
-	/** 
-	 * Returns the value of {@link $timeout} parameter.
-	 * @return int
-	 */
-	public function getTimeout() {
-		return $this->timeout;
-	}
-	/** 
-	 * Returns the mongodb connection.
-	 * @return Mongo
-	 */
-	public function getConnection() {
-		return $this->connection;
-	}
-	
-	/** 
-	 * Returns the active mongodb collection.
-	 * @return MongoCollection
-	 */
-	public function getCollection() {
-		return $this->collection;
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/appenders/LoggerAppenderNull.php
----------------------------------------------------------------------
diff --git a/src/main/php/appenders/LoggerAppenderNull.php b/src/main/php/appenders/LoggerAppenderNull.php
deleted file mode 100644
index c1c914d..0000000
--- a/src/main/php/appenders/LoggerAppenderNull.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *	   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * A NullAppender merely exists, it never outputs a message to any device.	
- *
- * This appender has no configurable parameters.
- * 
- * @version $Revision$
- * @package log4php
- * @subpackage appenders
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/null.html Appender documentation
- */
-class LoggerAppenderNull extends LoggerAppender {
-
-	/** 
-	 * This appender does not require a layout. 
-	 */
-	protected $requiresLayout = false;
-	
-	/**
-	 * Do nothing. 
-	 * 
-	 * @param LoggerLoggingEvent $event
-	 */
-	public function append(LoggerLoggingEvent $event) {
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/appenders/LoggerAppenderPDO.php
----------------------------------------------------------------------
diff --git a/src/main/php/appenders/LoggerAppenderPDO.php b/src/main/php/appenders/LoggerAppenderPDO.php
deleted file mode 100644
index 6443aad..0000000
--- a/src/main/php/appenders/LoggerAppenderPDO.php
+++ /dev/null
@@ -1,282 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * LoggerAppenderPDO appender logs to a database using the PHP's PDO extension.
- *
- * ## Configurable parameters: ##
- *
- * - dsn             - The Data Source Name (DSN) used to connect to the database.
- * - user            - Username used to connect to the database.
- * - password        - Password used to connect to the database.
- * - table           - Name of the table to which log entries are be inserted.
- * - insertSQL       - Sets the insert statement for a logging event. Defaults
- *                     to the correct one - change only if you are sure what you are doing.
- * - insertPattern   - The conversion pattern to use in conjuction with insert 
- *                     SQL. Must contain the same number of comma separated 
- *                     conversion patterns as there are question marks in the 
- *                     insertSQL.
- *
- * @version $Revision$
- * @package log4php
- * @subpackage appenders
- * @since 2.0
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/pdo.html Appender documentation
- */
-class LoggerAppenderPDO extends LoggerAppender {
-
-	// ******************************************
-	// *** Configurable parameters            ***
-	// ******************************************
-	
-	/** 
-	 * DSN string used to connect to the database.
-	 * @see http://www.php.net/manual/en/pdo.construct.php
-	 */
-	protected $dsn;
-
-	/** Database user name. */
-	protected $user;
-	
-	/** Database password. */
-	protected $password;
-	
-	/** 
-	 * The insert query.
-	 * 
-	 * The __TABLE__ placeholder will be replaced by the table name from 
-	 * {@link $table}.
-	 *  
-	 * The questionmarks are part of the prepared statement, and they must 
-	 * match the number of conversion specifiers in {@link insertPattern}.
-	 */
-	protected $insertSQL = "INSERT INTO __TABLE__ (timestamp, logger, level, message, thread, file, line) VALUES (?, ?, ?, ?, ?, ?, ?)";
-
-	/** 
-	 * A comma separated list of {@link LoggerPatternLayout} format strings 
-	 * which replace the "?" in {@link $insertSQL}.
-	 * 
-	 * Must contain the same number of comma separated conversion patterns as 
-	 * there are question marks in {@link insertSQL}.
- 	 * 
- 	 * @see LoggerPatternLayout For conversion patterns.
-	 */
-	protected $insertPattern = "%date{Y-m-d H:i:s},%logger,%level,%message,%pid,%file,%line";
-
-	/** Name of the table to which to append log events. */
-	protected $table = 'log4php_log';
-	
-	/** The number of recconect attempts to make on failed append. */
-	protected $reconnectAttempts = 3;
-	
-	
-	// ******************************************
-	// *** Private memebers                   ***
-	// ******************************************
-	
-	/** 
-	 * The PDO instance.
-	 * @var PDO 
-	 */
-	protected $db;
-	
-	/** 
-	 * Prepared statement for the insert query.
-	 * @var PDOStatement 
-	 */
-	protected $preparedInsert;
-	
-	/** This appender does not require a layout. */
-	protected $requiresLayout = false;
-
-
-	// ******************************************
-	// *** Appender methods                   ***
-	// ******************************************
-	
-	/**
-	 * Acquires a database connection based on parameters.
-	 * Parses the insert pattern to create a chain of converters which will be
-	 * used in forming query parameters from logging events.
-	 */
-	public function activateOptions() {
-		try {
-			$this->establishConnection();
-		} catch (PDOException $e) {
-			$this->warn("Failed connecting to database. Closing appender. Error: " . $e->getMessage());
-			$this->close();
-			return;
-		}
-
-		// Parse the insert patterns; pattern parts are comma delimited
-		$pieces = explode(',', $this->insertPattern);
-		$converterMap = LoggerLayoutPattern::getDefaultConverterMap();
-		foreach($pieces as $pattern) {
-			$parser = new LoggerPatternParser($pattern, $converterMap);
-			$this->converters[] = $parser->parse(); 
-		}
-		
-		$this->closed = false;
-	}
-	
-	/** 
-	 * Connects to the database, and prepares the insert query.
-	 * @throws PDOException If connect or prepare fails.  
-	 */
-	protected function establishConnection() {
-		// Acquire database connection
-		$this->db = new PDO($this->dsn, $this->user, $this->password);
-		$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
-		
-		// Prepare the insert statement
-		$insertSQL = str_replace('__TABLE__', $this->table, $this->insertSQL);
-		$this->preparedInsert = $this->db->prepare($insertSQL);
-	}
-	
-	/**
-	 * Appends a new event to the database.
-	 * 
-	 * If writing to database fails, it will retry by re-establishing the 
-	 * connection up to $reconnectAttempts times. If writing still fails, 
-	 * the appender will close.
-	 */
-	public function append(LoggerLoggingEvent $event) {
-
-		for ($attempt = 1; $attempt <= $this->reconnectAttempts + 1; $attempt++) {
-			try {
-				// Attempt to write to database
-				$this->preparedInsert->execute($this->format($event));
-				$this->preparedInsert->closeCursor();
-				break;
-			} catch (PDOException $e) {
-				$this->warn("Failed writing to database: ". $e->getMessage());
-				
-				// Close the appender if it's the last attempt
-				if ($attempt > $this->reconnectAttempts) {
-					$this->warn("Failed writing to database after {$this->reconnectAttempts} reconnect attempts. Closing appender.");
-					$this->close();
-				// Otherwise reconnect and try to write again
-				} else {
-					$this->warn("Attempting a reconnect (attempt $attempt of {$this->reconnectAttempts}).");
-					$this->establishConnection();
-				}
-			}
-		}
-	}
-	
-	/**
-	 * Converts the logging event to a series of database parameters by using 
-	 * the converter chain which was set up on activation. 
-	 */
-	protected function format(LoggerLoggingEvent $event) {
-		$params = array();
-		foreach($this->converters as $converter) {
-			$buffer = '';
-			while ($converter !== null) {
-				$converter->format($buffer, $event);
-				$converter = $converter->next;
-			}
-			$params[] = $buffer;
-		}
-		return $params;
-	}
-	
-	/**
-	 * Closes the connection to the logging database
-	 */
-	public function close() {
-		// Close the connection (if any)
-		$this->db = null;
-		
-		// Close the appender
-		$this->closed = true;
-	}
-	
-	// ******************************************
-	// *** Accessor methods                   ***
-	// ******************************************
-	
-	/**
-	 * Returns the active database handle or null if not established.
-	 * @return PDO
-	 */
-	public function getDatabaseHandle() {
-		return $this->db;
-	}
-	
-	/** Sets the username. */
-	public function setUser($user) {
-		$this->setString('user', $user);
-	}
-	
-	/** Returns the username. */
-	public function getUser($user) {
-		return $this->user;
-	}
-	
-	/** Sets the password. */
-	public function setPassword($password) {
-		$this->setString('password', $password);
-	}
-	
-	/** Returns the password. */
-	public function getPassword($password) {
-		return $this->password;
-	}
-	
-	/** Sets the insert SQL. */
-	public function setInsertSQL($sql) {
-		$this->setString('insertSQL', $sql);
-	}
-	
-	/** Returns the insert SQL. */
-	public function getInsertSQL($sql) {
-		return $this->insertSQL;
-	}
-
-	/** Sets the insert pattern. */
-	public function setInsertPattern($pattern) {
-		$this->setString('insertPattern', $pattern);
-	}
-	
-	/** Returns the insert pattern. */
-	public function getInsertPattern($pattern) {
-		return $this->insertPattern;
-	}
-
-	/** Sets the table name. */
-	public function setTable($table) {
-		$this->setString('table', $table);
-	}
-	
-	/** Returns the table name. */
-	public function getTable($table) {
-		return $this->table;
-	}
-	
-	/** Sets the DSN string. */
-	public function setDSN($dsn) {
-		$this->setString('dsn', $dsn);
-	}
-	
-	/** Returns the DSN string. */
-	public function getDSN($dsn) {
-		return $this->setString('dsn', $dsn);
-	}	
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/appenders/LoggerAppenderPhp.php
----------------------------------------------------------------------
diff --git a/src/main/php/appenders/LoggerAppenderPhp.php b/src/main/php/appenders/LoggerAppenderPhp.php
deleted file mode 100644
index 7758405..0000000
--- a/src/main/php/appenders/LoggerAppenderPhp.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *	   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * LoggerAppenderPhp logs events by creating a PHP user-level message using 
- * the PHP's trigger_error()function.
- *
- * This appender has no configurable parameters.
- *
- * Levels are mapped as follows:
- * 
- * - <b>level < WARN</b> mapped to E_USER_NOTICE
- * - <b>WARN <= level < ERROR</b> mapped to E_USER_WARNING
- * - <b>level >= ERROR</b> mapped to E_USER_ERROR  
- *
- * @version $Revision$
- * @package log4php
- * @subpackage appenders
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/php.html Appender documentation
- */ 
-class LoggerAppenderPhp extends LoggerAppender {
-
-	public function append(LoggerLoggingEvent $event) {
-		$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);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/appenders/LoggerAppenderRollingFile.php
----------------------------------------------------------------------
diff --git a/src/main/php/appenders/LoggerAppenderRollingFile.php b/src/main/php/appenders/LoggerAppenderRollingFile.php
deleted file mode 100644
index 80b6462..0000000
--- a/src/main/php/appenders/LoggerAppenderRollingFile.php
+++ /dev/null
@@ -1,305 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *	   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @package log4php
- */
-
-/**
- * LoggerAppenderRollingFile writes logging events to a specified file. The 
- * file is rolled over after a specified size has been reached.
- * 
- * This appender uses a layout.
- *
- * ## Configurable parameters: ##
- * 
- * - **file** - Path to the target file.
- * - **append** - If set to true, the appender will append to the file, 
- *     otherwise the file contents will be overwritten.
- * - **maxBackupIndex** - Maximum number of backup files to keep. Default is 1.
- * - **maxFileSize** - Maximum allowed file size (in bytes) before rolling 
- *     over. Suffixes "KB", "MB" and "GB" are allowed. 10KB = 10240 bytes, etc.
- *     Default is 10M.
- * - **compress** - If set to true, rolled-over files will be compressed. 
- *     Requires the zlib extension.
- *
- * @version $Revision$
- * @package log4php
- * @subpackage appenders
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/rolling-file.html Appender documentation
- */
-class LoggerAppenderRollingFile extends LoggerAppenderFile {
-
-	/** Compressing backup files is done in chunks, this determines how large. */
-	const COMPRESS_CHUNK_SIZE = 102400; // 100KB
-	
-	/**
-	 * The maximum size (in bytes) that the output file is allowed to reach 
-	 * before being rolled over to backup files.
-	 *
-	 * The default maximum file size is 10MB (10485760 bytes). Maximum value 
-	 * for this option may depend on the file system.
-	 *
-	 * @var integer
-	 */
-	protected $maxFileSize = 10485760;
-	
-	/**
-	 * Set the maximum number of backup files to keep around.
-	 * 
-	 * 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 <var>maxFileSize</var>.
-	 * 
-	 * There is one backup file by default.
-	 *
-	 * @var integer 
-	 */
-	protected $maxBackupIndex = 1;
-	
-	/**
-	 * The <var>compress</var> parameter determindes the compression with zlib. 
-	 * If set to true, the rollover files are compressed and saved with the .gz extension.
-	 * @var boolean
-	 */
-	protected $compress = false;
-
-	/**
-	 * Set to true in the constructor if PHP >= 5.3.0. In that case clearstatcache
-	 * supports conditional clearing of statistics.
-	 * @var boolean
-	 * @see http://php.net/manual/en/function.clearstatcache.php
-	 */
-	private $clearConditional = false;
-	
-	/**
-	 * Get the maximum size that the output file is allowed to reach
-	 * before being rolled over to backup files.
-	 * @return integer
-	 */
-	public function getMaximumFileSize() {
-		return $this->maxFileSize;
-	}
-
-	public function __construct($name = '') {
-		parent::__construct($name);
-		if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
-			$this->clearConditional = true;
-		}
-	}
-	
-	/**
-	 * Implements the usual roll over behaviour.
-	 *
-	 * 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.
-	 * 
-	 * If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created.
-	 * 
-	 * Rollover must be called while the file is locked so that it is safe for concurrent access. 
-	 * 
-	 * @throws LoggerException If any part of the rollover procedure fails.
-	 */
-	private function rollOver() {
-		// If maxBackups <= 0, then there is no file renaming to be done.
-		if($this->maxBackupIndex > 0) {
-			// Delete the oldest file, to keep Windows happy.
-			$file = $this->file . '.' . $this->maxBackupIndex;
-			
-			if (file_exists($file) && !unlink($file)) {
-				throw new LoggerException("Unable to delete oldest backup file from [$file].");
-			}
-
-			// Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2}
-			$this->renameArchievedLogs($this->file);
-	
-			// Backup the active file
-			$this->moveToBackup($this->file);
-		}
-		
-		// Truncate the active file
-		ftruncate($this->fp, 0);
-		rewind($this->fp);
-	}
-	
-	private function moveToBackup($source) {
-		if ($this->compress) {
-			$target = $source . '.1.gz';
-			$this->compressFile($source, $target);
-		} else {
-			$target = $source . '.1';
-			copy($source, $target);
-		}
-	}
-	
-	private function compressFile($source, $target) {
-		$target = 'compress.zlib://' . $target;
-		
-		$fin = fopen($source, 'rb');
-		if ($fin === false) {
-			throw new LoggerException("Unable to open file for reading: [$source].");
-		}
-		
-		$fout = fopen($target, 'wb');
-		if ($fout === false) {
-			throw new LoggerException("Unable to open file for writing: [$target].");
-		}
-	
-		while (!feof($fin)) {
-			$chunk = fread($fin, self::COMPRESS_CHUNK_SIZE);
-			if (false === fwrite($fout, $chunk)) {
-				throw new LoggerException("Failed writing to compressed file.");
-			}
-		}
-	
-		fclose($fin);
-		fclose($fout);
-	}
-	
-	private function renameArchievedLogs($fileName) {
-		for($i = $this->maxBackupIndex - 1; $i >= 1; $i--) {
-			
-			$source = $fileName . "." . $i;
-			if ($this->compress) {
-				$source .= '.gz';
-			}
-			
-			if(file_exists($source)) {
-				$target = $fileName . '.' . ($i + 1);
-				if ($this->compress) {
-					$target .= '.gz';
-				}				
-				
-				rename($source, $target);
-			}
-		}
-	}
-	
-	/**
-	 * Writes a string to the target file. Opens file if not already open.
-	 * @param string $string Data to write.
-	 */
-	protected function write($string) {
-		// Lazy file open
-		if(!isset($this->fp)) {
-			if ($this->openFile() === false) {
-				return; // Do not write if file open failed.
-			}
-		}
-		
-		// Lock the file while writing and possible rolling over
-		if(flock($this->fp, LOCK_EX)) {
-			
-			// Write to locked file
-			if(fwrite($this->fp, $string) === false) {
-				$this->warn("Failed writing to file. Closing appender.");
-				$this->closed = true;
-			}
-			
-			// Stats cache must be cleared, otherwise filesize() returns cached results
-			// If supported (PHP 5.3+), clear only the state cache for the target file
-			if ($this->clearConditional) {
-				clearstatcache(true, $this->file);
-			} else {
-				clearstatcache();
-			}
-			
-			// Rollover if needed
-			if (filesize($this->file) > $this->maxFileSize) {
-				try {
-					$this->rollOver();
-				} catch (LoggerException $ex) {
-					$this->warn("Rollover failed: " . $ex->getMessage() . " Closing appender.");
-					$this->closed = true;
-				}
-			}
-			
-			flock($this->fp, LOCK_UN);
-		} else {
-			$this->warn("Failed locking file for writing. Closing appender.");
-			$this->closed = true;
-		}
-	}
-	
-	public function activateOptions() {
-		parent::activateOptions();
-		
-		if ($this->compress && !extension_loaded('zlib')) {
-			$this->warn("The 'zlib' extension is required for file compression. Disabling compression.");
-			$this->compression = false;
-		}
-	}
-	
-	/**
-	 * Set the 'maxBackupIndex' parameter.
-	 * @param integer $maxBackupIndex
-	 */
-	public function setMaxBackupIndex($maxBackupIndex) {
-		$this->setPositiveInteger('maxBackupIndex', $maxBackupIndex);
-	}
-	
-	/**
-	 * Returns the 'maxBackupIndex' parameter.
-	 * @return integer
-	 */
-	public function getMaxBackupIndex() {
-		return $this->maxBackupIndex;
-	}
-	
-	/**
-	 * Set the 'maxFileSize' parameter.
-	 * @param mixed $maxFileSize
-	 */
-	public function setMaxFileSize($maxFileSize) {
-		$this->setFileSize('maxFileSize', $maxFileSize);
-	}
-	
-	/**
-	 * Returns the 'maxFileSize' parameter.
-	 * @return integer
-	 */
-	public function getMaxFileSize() {
-		return $this->maxFileSize;
-	}
-	
-	/**
-	 * Set the 'maxFileSize' parameter (kept for backward compatibility).
-	 * @param mixed $maxFileSize
-	 * @deprecated Use setMaxFileSize() instead.
-	 */
-	public function setMaximumFileSize($maxFileSize) {
-		$this->warn("The 'maximumFileSize' parameter is deprecated. Use 'maxFileSize' instead.");
-		return $this->setMaxFileSize($maxFileSize);
-	}
-	
-	/**
-	 * Sets the 'compress' parameter.
-	 * @param boolean $compress
-	 */
-	public function setCompress($compress) {
-		$this->setBoolean('compress', $compress);
-	}
-	
-	/**
-	 * Returns the 'compress' parameter.
-	 * @param boolean 
-	 */
-	public function getCompress() {
-		return $this->compress;
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/appenders/LoggerAppenderSocket.php
----------------------------------------------------------------------
diff --git a/src/main/php/appenders/LoggerAppenderSocket.php b/src/main/php/appenders/LoggerAppenderSocket.php
deleted file mode 100644
index f4d7241..0000000
--- a/src/main/php/appenders/LoggerAppenderSocket.php
+++ /dev/null
@@ -1,122 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *	   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * LoggerAppenderSocket appends to a network socket.
- *
- * ## Configurable parameters: ##
- * 
- * - **remoteHost** - Target remote host.
- * - **port** - Target port (optional, defaults to 4446).
- * - **timeout** - Connection timeout in seconds (optional, defaults to 
- *     'default_socket_timeout' from php.ini)
- * 
- * The socket will by default be opened in blocking mode.
- * 
- * @version $Revision$
- * @package log4php
- * @subpackage appenders
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/socket.html Appender documentation
- */ 
-class LoggerAppenderSocket extends LoggerAppender {
-	
-	/** 
-	 * Target host.
-	 * @see http://php.net/manual/en/function.fsockopen.php 
-	 */
-	protected $remoteHost;
-	
-	/** Target port */
-	protected $port = 4446;
-	
-	/** Connection timeout in ms. */
-	protected $timeout;
-	
-	// ******************************************
-	// *** Appender methods                   ***
-	// ******************************************
-	
-	/** Override the default layout to use serialized. */
-	public function getDefaultLayout() {
-		return new LoggerLayoutSerialized();
-	}
-	
-	public function activateOptions() {
-		if (empty($this->remoteHost)) {
-			$this->warn("Required parameter [remoteHost] not set. Closing appender.");
-			$this->closed = true;
-			return;
-		}
-	
-		if (empty($this->timeout)) {
-			$this->timeout = ini_get("default_socket_timeout");
-		}
-	
-		$this->closed = false;
-	}
-	
-	public function append(LoggerLoggingEvent $event) {
-		$socket = fsockopen($this->remoteHost, $this->port, $errno, $errstr, $this->timeout);
-		if ($socket === false) {
-			$this->warn("Could not open socket to {$this->remoteHost}:{$this->port}. Closing appender.");
-			$this->closed = true;
-			return;
-		}
-	
-		if (false === fwrite($socket, $this->layout->format($event))) {
-			$this->warn("Error writing to socket. Closing appender.");
-			$this->closed = true;
-		}
-		fclose($socket);
-	}
-	
-	// ******************************************
-	// *** Accessor methods                   ***
-	// ******************************************
-	
-	/** Sets the target host. */
-	public function setRemoteHost($hostname) {
-		$this->setString('remoteHost', $hostname);
-	}
-	
-	/** Sets the target port */
-	public function setPort($port) {
-		$this->setPositiveInteger('port', $port);
-	}
-	 
-	/** Sets the timeout. */
-	public function setTimeout($timeout) {
-		$this->setPositiveInteger('timeout', $timeout);
-	}
-	
-	/** Returns the target host. */
-	public function getRemoteHost() {
-		return $this->getRemoteHost();
-	}
-	
-	/** Returns the target port. */
-	public function getPort() {
-		return $this->port;
-	}
-	
-	/** Returns the timeout */
-	public function getTimeout() {
-		return $this->timeout;
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/appenders/LoggerAppenderSyslog.php
----------------------------------------------------------------------
diff --git a/src/main/php/appenders/LoggerAppenderSyslog.php b/src/main/php/appenders/LoggerAppenderSyslog.php
deleted file mode 100644
index 38d98f2..0000000
--- a/src/main/php/appenders/LoggerAppenderSyslog.php
+++ /dev/null
@@ -1,303 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *	   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Log events to a system log using the PHP syslog() function.
- *
- * This appenders requires a layout.
- *
- * ## Configurable parameters: ##
- * 
- * - **ident** - The ident of the syslog message.
- * - **priority** - The priority for the syslog message (used when overriding 
- *     priority).
- * - **facility** - The facility for the syslog message
- * - **overridePriority** - If set to true, the message priority will always 
- *     use the value defined in {@link $priority}, otherwise the priority will
- *     be determined by the message's log level.  
- * - **option** - The option value for the syslog message. 
- *
- * Recognised syslog options are:
- * 
- * - CONS 	 - if there is an error while sending data to the system logger, write directly to the system console
- * - NDELAY - open the connection to the logger immediately
- * - ODELAY - delay opening the connection until the first message is logged (default)
- * - PERROR - print log message also to standard error
- * - PID    - include PID with each message
- * 
- * Multiple options can be set by delimiting them with a pipe character, 
- * e.g.: "CONS|PID|PERROR".
- * 
- * Recognised syslog priorities are:
- * 
- * - EMERG
- * - ALERT
- * - CRIT
- * - ERR
- * - WARNING
- * - NOTICE
- * - INFO
- * - DEBUG
- *
- * Levels are mapped as follows:
- * 
- * - <b>FATAL</b> to LOG_ALERT
- * - <b>ERROR</b> to LOG_ERR 
- * - <b>WARN</b> to LOG_WARNING
- * - <b>INFO</b> to LOG_INFO
- * - <b>DEBUG</b> to LOG_DEBUG
- * - <b>TRACE</b> to LOG_DEBUG
- *
- * @version $Revision$
- * @package log4php
- * @subpackage appenders
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @link http://logging.apache.org/log4php/docs/appenders/syslog.html Appender documentation
- */ 
-class LoggerAppenderSyslog extends LoggerAppender {
-	
-	/**
-	 * The ident string is added to each message. Typically the name of your application.
-	 * 
-	 * @var string 
-	 */
-	protected $ident = "Apache log4php";
-
-	/**
-	 * The syslog priority to use when overriding priority. This setting is 
-	 * required if {@link overridePriority} is set to true. 
-	 * 
-	 * @var string 
-	 */
-	protected $priority;
-	
-	/**
-	 * The option used when opening the syslog connection.
-	 * 
-	 * @var string
-	 */
-	protected $option = 'PID|CONS';
-	
-	/**
-	 * The facility value indicates the source of the message.
-	 *
-	 * @var string
-	 */
-	protected $facility = 'USER';
-	
-	/**
-	 * If set to true, the message priority will always use the value defined 
-	 * in {@link $priority}, otherwise the priority will be determined by the 
-	 * message's log level.
-	 *
-	 * @var string
-	 */
-	protected $overridePriority = false;
-
-	/**
-	 * Holds the int value of the {@link $priority}.
-	 * @var int
-	 */
-	private $intPriority;
-	
-	/**
-	 * Holds the int value of the {@link $facility}.
-	 * @var int
-	 */
-	private $intFacility;
-	
-	/**
-	 * Holds the int value of the {@link $option}.
-	 * @var int
-	 */
-	private $intOption;
-
-	/**
-	 * Sets the {@link $ident}.
-	 *
-	 * @param string $ident
-	 */
-	public function setIdent($ident) {
-		$this->ident = $ident; 
-	}
-	
-	/**
-	 * Sets the {@link $priority}.
-	 *
-	 * @param string $priority
-	 */
-	public function setPriority($priority) {
-		$this->priority = $priority;
-	}
-	
-	/**
-	 * Sets the {@link $facility}.
-	 *
-	 * @param string $facility
-	 */
-	public function setFacility($facility) {
-		$this->facility = $facility;
-	} 
-	
-	/**
-	 * Sets the {@link $overridePriority}.
-	 *
-	 * @param string $overridePriority
-	 */
-	public function setOverridePriority($overridePriority) {
-		$this->overridePriority = $overridePriority;
-	} 
-	
-	/**
-	* Sets the 'option' parameter.
-	*
-	* @param string $option
-	*/
-	public function setOption($option) {
-		$this->option = $option;
-	}
-	
-	/**
-	* Returns the 'ident' parameter.
-	*
-	* @return string $ident
-	*/
-	public function getIdent() {
-		return $this->ident;
-	}
-	
-	/**
-	 * Returns the 'priority' parameter.
-	 *
-	 * @return string
-	 */
-	public function getPriority() {
-		return $this->priority;
-	}
-	
-	/**
-	 * Returns the 'facility' parameter.
-	 *
-	 * @return string
-	 */
-	public function getFacility() {
-		return $this->facility;
-	}
-	
-	/**
-	 * Returns the 'overridePriority' parameter.
-	 *
-	 * @return string
-	 */
-	public function getOverridePriority() {
-		return $this->overridePriority;
-	}
-	
-	/**
-	 * Returns the 'option' parameter.
-	 *
-	 * @return string
-	 */
-	public function getOption() {
-		return $this->option;
-	}
-	
-	
-	public function activateOptions() {
-		$this->intPriority = $this->parsePriority();
-		$this->intOption   = $this->parseOption();
-		$this->intFacility = $this->parseFacility();
-		
-		$this->closed = false;
-	}
-	
-	public function close() {
-		if($this->closed != true) {
-			closelog();
-			$this->closed = true;
-		}
-	}
-
-	/** 
-	 * Appends the event to syslog.
-	 * 
-	 * Log is opened and closed each time because if it is not closed, it
-	 * can cause the Apache httpd server to log to whatever ident/facility 
-	 * was used in openlog().
-	 *
-	 * @see http://www.php.net/manual/en/function.syslog.php#97843
-	 */
-	public function append(LoggerLoggingEvent $event) {
-		$priority = $this->getSyslogPriority($event->getLevel());
-		$message = $this->layout->format($event);
-	
-		openlog($this->ident, $this->intOption, $this->intFacility);
-		syslog($priority, $message);
-		closelog();
-	}
-	
-	/** Determines which syslog priority to use based on the given level. */
-	private function getSyslogPriority(LoggerLevel $level) {
-		if($this->overridePriority) {
-			return $this->intPriority;
-		}
-		return $level->getSyslogEquivalent();
-	}
-	
-	/** Parses a syslog option string and returns the correspodning int value. */
-	private function parseOption() {
-		$value = 0;
-		$options = explode('|', $this->option);
-	
-		foreach($options as $option) {
-			if (!empty($option)) {
-				$constant = "LOG_" . trim($option);
-				if (defined($constant)) {
-					$value |= constant($constant);
-				} else {
-					trigger_error("log4php: Invalid syslog option provided: $option. Whole option string: {$this->option}.", E_USER_WARNING);
-				}
-			}
-		}
-		return $value;
-	}
-	
-	/** Parses the facility string and returns the corresponding int value. */
-	private function parseFacility() {
-		if (!empty($this->facility)) {   
-			$constant = "LOG_" . trim($this->facility);
-			if (defined($constant)) {
-				return constant($constant);
-			} else {
-				trigger_error("log4php: Invalid syslog facility provided: {$this->facility}.", E_USER_WARNING);
-			}
-		}
-	}
-
-	/** Parses the priority string and returns the corresponding int value. */
-	private function parsePriority() {
-		if (!empty($this->priority)) {
-			$constant = "LOG_" . trim($this->priority);
-			if (defined($constant)) {
-				return constant($constant);
-			} else {
-				trigger_error("log4php: Invalid syslog priority provided: {$this->priority}.", E_USER_WARNING);
-			}
-		}	
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/configurators/LoggerConfigurationAdapter.php
----------------------------------------------------------------------
diff --git a/src/main/php/configurators/LoggerConfigurationAdapter.php b/src/main/php/configurators/LoggerConfigurationAdapter.php
deleted file mode 100644
index ab87923..0000000
--- a/src/main/php/configurators/LoggerConfigurationAdapter.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * @package log4php
- */
-
-/**
- * The interface for configurator adapters.
- * 
- * Adapters convert configuration in several formats such as XML, ini and PHP 
- * file to a PHP array. 
- * 
- * @package log4php
- * @subpackage configurators
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @since 2.2
- */
-interface LoggerConfigurationAdapter
-{
-	/** Converts the configuration file to PHP format usable by the configurator. */
-	public function convert($input); 
-
-}
-

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/configurators/LoggerConfigurationAdapterINI.php
----------------------------------------------------------------------
diff --git a/src/main/php/configurators/LoggerConfigurationAdapterINI.php b/src/main/php/configurators/LoggerConfigurationAdapterINI.php
deleted file mode 100644
index aaeadf8..0000000
--- a/src/main/php/configurators/LoggerConfigurationAdapterINI.php
+++ /dev/null
@@ -1,299 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * @package log4php
- */
-
-/**
- * Converts ini configuration files to a PHP array.
- * 
- * These used to be called "properties" files (inherited from log4j), and that 
- * file extension is still supported. 
- *
- * @package log4php
- * @subpackage configurators
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @since 2.2
- */
-class LoggerConfigurationAdapterINI implements LoggerConfigurationAdapter {
-	
-	/** Name to assign to the root logger. */
-	const ROOT_LOGGER_NAME = "root";
-
-	/** Prefix used for defining logger additivity. */
-	const ADDITIVITY_PREFIX = "log4php.additivity.";
-	
-	/** Prefix used for defining logger threshold. */
-	const THRESHOLD_PREFIX = "log4php.threshold";
-	
-	/** Prefix used for defining the root logger. */
-	const ROOT_LOGGER_PREFIX = "log4php.rootLogger";
-	
-	/** Prefix used for defining a logger. */
-	const LOGGER_PREFIX = "log4php.logger.";
-	
-	/** Prefix used for defining an appender. */
-	const APPENDER_PREFIX = "log4php.appender.";
-	
-	/** Prefix used for defining a renderer. */
-	const RENDERER_PREFIX = "log4php.renderer.";
-	
-	/** Holds the configuration. */
-	private $config = array();
-	
-	/**
-	 * Loads and parses the INI configuration file.
-	 * 
-	 * @param string $url Path to the config file.
-	 * @throws LoggerException
-	 */
-	private function load($url) {
-		if (!file_exists($url)) {
-			throw new LoggerException("File [$url] does not exist.");
-		}
-		
-		$properties = @parse_ini_file($url, true);
-		if ($properties === false) {
-			$error = error_get_last();
-			throw new LoggerException("Error parsing configuration file: {$error['message']}");
-		}
-		
-		return $properties;
-	}
-	
-	/**
-	* Converts the provided INI configuration file to a PHP array config.
-	*
-	* @param string $path Path to the config file.
-	* @throws LoggerException If the file cannot be loaded or parsed.
-	*/
-	public function convert($path) {
-		// Load the configuration
-		$properties = $this->load($path);
-		
-		// Parse threshold
-		if (isset($properties[self::THRESHOLD_PREFIX])) {
-			$this->config['threshold'] = $properties[self::THRESHOLD_PREFIX]; 
-		}
-		
-		// Parse root logger
-		if (isset($properties[self::ROOT_LOGGER_PREFIX])) {
-			$this->parseLogger($properties[self::ROOT_LOGGER_PREFIX], self::ROOT_LOGGER_NAME);
-		}
-		
-		$appenders = array();
-		
-		foreach($properties as $key => $value) {
-			// Parse loggers
-			if ($this->beginsWith($key, self::LOGGER_PREFIX)) {
-				$name = substr($key, strlen(self::LOGGER_PREFIX));
-				$this->parseLogger($value, $name);
-			}
-			
-			// Parse additivity
-			if ($this->beginsWith($key, self::ADDITIVITY_PREFIX)) {
-				$name = substr($key, strlen(self::ADDITIVITY_PREFIX));
-				$this->config['loggers'][$name]['additivity'] = $value;
-			}
-			
-			// Parse appenders
-			else if ($this->beginsWith($key, self::APPENDER_PREFIX)) {
-				$this->parseAppender($key, $value);
-			}
-			
-			// Parse renderers
-			else if ($this->beginsWith($key, self::RENDERER_PREFIX)) {
-				$this->parseRenderer($key, $value);
-			}
-		}
-		
-		return $this->config;
-	}
-	
-	
-	/**
-	 * Parses a logger definition.
-	 * 
-	 * Loggers are defined in the following manner:
-	 * <pre>
-	 * log4php.logger.<name> = [<level>], [<appender-ref>, <appender-ref>, ...] 
-	 * </pre>
-	 * 
-	 * @param string $value The configuration value (level and appender-refs).
-	 * @param string $name Logger name. 
-	 */
-	private function parseLogger($value, $name) {
-		// Value is divided by commas
-		$parts = explode(',', $value);
-		if (empty($value) || empty($parts)) {
-			return;
-		}
-
-		// The first value is the logger level 
-		$level = array_shift($parts);
-		
-		// The remaining values are appender references 
-		$appenders = array();
-		while($appender = array_shift($parts)) {
-			$appender = trim($appender);
-			if (!empty($appender)) {
-				$appenders[] = trim($appender);
-			}
-		}
-
-		// Find the target configuration 
-		if ($name == self::ROOT_LOGGER_NAME) {
-			$this->config['rootLogger']['level'] = trim($level);
-			$this->config['rootLogger']['appenders'] = $appenders;
-		} else {
-			$this->config['loggers'][$name]['level'] = trim($level);
-			$this->config['loggers'][$name]['appenders'] = $appenders;
-		}
-	}
-	
-	/**
-	 * Parses an configuration line pertaining to an appender.
-	 * 
-	 * Parses the following patterns:
-	 * 
-	 * Appender class:
-	 * <pre>
-	 * log4php.appender.<name> = <class>
-	 * </pre>
-	 * 
-	 * Appender parameter:
-	 * <pre>
-	 * log4php.appender.<name>.<param> = <value>
-	 * </pre>
-	 * 
- 	 * Appender threshold:
-	 * <pre>
-	 * log4php.appender.<name>.threshold = <level>
-	 * </pre>
-	 * 
- 	 * Appender layout:
-	 * <pre>
-	 * log4php.appender.<name>.layout = <layoutClass>
-	 * </pre>
-	 * 
-	 * Layout parameter:
-	 * <pre>
-	 * log4php.appender.<name>.layout.<param> = <value>
-	 * </pre> 
-	 * 
-	 * For example, a full appender config might look like:
-	 * <pre>
-	 * log4php.appender.myAppender = LoggerAppenderConsole
-	 * log4php.appender.myAppender.threshold = info
-	 * log4php.appender.myAppender.target = stdout
-	 * log4php.appender.myAppender.layout = LoggerLayoutPattern
-	 * log4php.appender.myAppender.layout.conversionPattern = "%d %c: %m%n"
-	 * </pre>
-	 * 
-	 * After parsing all these options, the following configuration can be 
-	 * found under $this->config['appenders']['myAppender']:
-	 * <pre>
-	 * array(
-	 * 	'class' => LoggerAppenderConsole,
-	 * 	'threshold' => info,
-	 * 	'params' => array(
-	 * 		'target' => 'stdout'
-	 * 	),
-	 * 	'layout' => array(
-	 * 		'class' => 'LoggerAppenderConsole',
-	 * 		'params' => array(
-	 * 			'conversionPattern' => '%d %c: %m%n'
-	 * 		)
-	 * 	)
-	 * )
-	 * </pre>
-	 * 
-	 * @param string $key
-	 * @param string $value
-	 */
-	private function parseAppender($key, $value) {
-
-		// Remove the appender prefix from key
-		$subKey = substr($key, strlen(self::APPENDER_PREFIX));
-		
-		// Divide the string by dots
-		$parts = explode('.', $subKey);
-		$count = count($parts);
-		
-		// The first part is always the appender name
-		$name = trim($parts[0]);
-		
-		// Only one part - this line defines the appender class 
-		if ($count == 1) {
-			$this->config['appenders'][$name]['class'] = $value;
-			return;
-		}
-		
-		// Two parts - either a parameter, a threshold or layout class
-		else if ($count == 2) {
-			
-			if ($parts[1] == 'layout') {
-				$this->config['appenders'][$name]['layout']['class'] = $value;
-				return;
-			} else if ($parts[1] == 'threshold') {
-				$this->config['appenders'][$name]['threshold'] = $value;
-				return;
-			} else {
-				$this->config['appenders'][$name]['params'][$parts[1]] = $value;
-				return;
-			}
-		}
-		
-		// Three parts - this can only be a layout parameter
-		else if ($count == 3) {
-			if ($parts[1] == 'layout') {
-				$this->config['appenders'][$name]['layout']['params'][$parts[2]] = $value;
-				return;
-			}
-		}
-		
-		trigger_error("log4php: Don't know how to parse the following line: \"$key = $value\". Skipping.");
-	}
-
-	/**
-	 * Parses a renderer definition.
-	 * 
-	 * Renderers are defined as:
-	 * <pre>
-	 * log4php.renderer.<renderedClass> = <renderingClass> 
-	 * </pre>
-	 * 
-	 * @param string $key log4php.renderer.<renderedClass>
-	 * @param string $value <renderingClass>
-	 */
-	private function parseRenderer($key, $value) {
-		// Remove the appender prefix from key
-		$renderedClass = substr($key, strlen(self::APPENDER_PREFIX));
-		$renderingClass = $value;
-		
-		$this->config['renderers'][] = compact('renderedClass', 'renderingClass');
-	}
-	
-	/** Helper method. Returns true if $str begins with $sub. */
-	private function beginsWith($str, $sub) {
-		return (strncmp($str, $sub, strlen($sub)) == 0);
-	}
-	
-	
-}
-

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/configurators/LoggerConfigurationAdapterPHP.php
----------------------------------------------------------------------
diff --git a/src/main/php/configurators/LoggerConfigurationAdapterPHP.php b/src/main/php/configurators/LoggerConfigurationAdapterPHP.php
deleted file mode 100644
index 3320409..0000000
--- a/src/main/php/configurators/LoggerConfigurationAdapterPHP.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *	   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * @package log4php
- */
-
-/**
- * Converts PHP configuration files to a PHP array.
- * 
- * The file should only hold the PHP config array preceded by "return".
- * 
- * Example PHP config file:
- * <code>
- * <?php
- * return array(
- *   'rootLogger' => array(
- *     'level' => 'info',
- *     'appenders' => array('default')
- *   ),
- *   'appenders' => array(
- *     'default' => array(
- *       'class' => 'LoggerAppenderEcho',
- *       'layout' => array(
- *       	'class' => 'LoggerLayoutSimple'
- *        )
- *     )
- *   )
- * )
- * ?>
- * </code>
- * 
- * @package log4php
- * @subpackage configurators
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @since 2.2
- */
-class LoggerConfigurationAdapterPHP implements LoggerConfigurationAdapter
-{
-	public function convert($url) {
-		if (!file_exists($url)) {
-			throw new LoggerException("File [$url] does not exist.");
-		}
-		
-		// Load the config file
-		$data = @file_get_contents($url);
-		if ($data === false) {
-			$error = error_get_last();
-			throw new LoggerException("Error loading config file: {$error['message']}");
-		}
-		
-		$config = @eval('?>' . $data);
-		
-		if ($config === false) {
-			$error = error_get_last();
-			throw new LoggerException("Error parsing configuration: " . $error['message']);
-		}
-		
-		if (empty($config)) {
-			throw new LoggerException("Invalid configuration: empty configuration array.");
-		}
-		
-		if (!is_array($config)) {
-			throw new LoggerException("Invalid configuration: not an array.");
-		}
-		
-		return $config;
-	}
-}
-

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/configurators/LoggerConfigurationAdapterXML.php
----------------------------------------------------------------------
diff --git a/src/main/php/configurators/LoggerConfigurationAdapterXML.php b/src/main/php/configurators/LoggerConfigurationAdapterXML.php
deleted file mode 100644
index 7032da6..0000000
--- a/src/main/php/configurators/LoggerConfigurationAdapterXML.php
+++ /dev/null
@@ -1,278 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * 
- * @package log4php
- */
-
-/**
- * Converts XML configuration files to a PHP array.
- * 
- * @package log4php
- * @subpackage configurators
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @since 2.2
- */
-class LoggerConfigurationAdapterXML implements LoggerConfigurationAdapter
-{
-	/** Path to the XML schema used for validation. */
-	const SCHEMA_PATH = '/../xml/log4php.xsd';
-	
-	private $config = array(
-		'appenders' => array(),
-		'loggers' => array(),
-		'renderers' => array(),
-	);
-	
-	public function convert($url) {
-		$xml = $this->loadXML($url);
-		
-		$this->parseConfiguration($xml);
-
-		// Parse the <root> node
-		if (isset($xml->root)) {		
-			$this->parseRootLogger($xml->root);
-		}
-		
-		// Process <logger> nodes
-		foreach($xml->logger as $logger) {
-			$this->parseLogger($logger);
-		} 
-		
-		// Process <appender> nodes
-		foreach($xml->appender as $appender) {
-			$this->parseAppender($appender);
-		}
-		
-		// Process <renderer> nodes
-		foreach($xml->renderer as $rendererNode) {
-			$this->parseRenderer($rendererNode);
-		}
-
-		// Process <defaultRenderer> node
-		foreach($xml->defaultRenderer as $rendererNode) {
-			$this->parseDefaultRenderer($rendererNode);
-		}
-
-		return $this->config;
-	}
-	
-	/**
-	 * Loads and validates the XML.
-	 * @param string $url Input XML.
-	 */
-	private function loadXML($url) {
-		if (!file_exists($url)) {
-			throw new LoggerException("File [$url] does not exist.");
-		}
-
-		libxml_clear_errors();
-		$oldValue = libxml_use_internal_errors(true);
-		
-		// Load XML
-		$xml = @simplexml_load_file($url);
-		if ($xml === false) {
-			
-			$errorStr = "";
-			foreach(libxml_get_errors() as $error) {
-				$errorStr .= $error->message;
-			}
-			
-			throw new LoggerException("Error loading configuration file: " . trim($errorStr));
-		}
-		
-		libxml_clear_errors();
-		libxml_use_internal_errors($oldValue);
-		
-		return $xml;
-	}
-	
-	/**
-	 * Parses the <configuration> node.
-	 */
-	private function parseConfiguration(SimpleXMLElement $xml) {
-		$attributes = $xml->attributes();
-		if (isset($attributes['threshold'])) {
-			$this->config['threshold'] = (string) $attributes['threshold'];
-		}
-	}
-	
-	/** Parses an <appender> node. */
-	private function parseAppender(SimpleXMLElement $node) {
-		$name = $this->getAttributeValue($node, 'name');
-		if (empty($name)) {
-			$this->warn("An <appender> node is missing the required 'name' attribute. Skipping appender definition.");
-			return;
-		}
-		
-		$appender = array();
-		$appender['class'] = $this->getAttributeValue($node, 'class');
-		
-		if (isset($node['threshold'])) {
-			$appender['threshold'] = $this->getAttributeValue($node, 'threshold');
-		}
-		
-		if (isset($node->layout)) {
-			$appender['layout']= $this->parseLayout($node->layout, $name);
-		}
-		
-		if (count($node->param) > 0) {
-			$appender['params'] = $this->parseParameters($node);
-		}
-		
-		foreach($node->filter as $filterNode) {
-			$appender['filters'][] = $this->parseFilter($filterNode);
-		}
-		
-		$this->config['appenders'][$name] = $appender;
-	}
-	
-	/** Parses a <layout> node. */
-	private function parseLayout(SimpleXMLElement $node, $appenderName) {
-		$layout = array();
-		$layout['class'] = $this->getAttributeValue($node, 'class');
-		
-		if (count($node->param) > 0) {
-			$layout['params'] = $this->parseParameters($node);
-		}
-		
-		return $layout;
-	}
-	/** Parses any <param> child nodes returning them in an array. */
-	private function parseParameters($paramsNode) {
-		$params = array();
-
-		foreach($paramsNode->param as $paramNode) {
-			if (empty($paramNode['name'])) {
-				$this->warn("A <param> node is missing the required 'name' attribute. Skipping parameter.");
-				continue;
-			}
-			
-			$name = $this->getAttributeValue($paramNode, 'name');
-			$value = $this->getAttributeValue($paramNode, 'value');
-			
-			$params[$name] = $value;
-		}
-
-		return $params;
-	}
-	
-	/** Parses a <root> node. */
-	private function parseRootLogger(SimpleXMLElement $node) {
-		$logger = array();
-		
-		if (isset($node->level)) {
-			$logger['level'] = $this->getAttributeValue($node->level, 'value');
-		}
-		
-		$logger['appenders'] = $this->parseAppenderReferences($node);
-		
-		$this->config['rootLogger'] = $logger;
-	}
-	
-	/** Parses a <logger> node. */
-	private function parseLogger(SimpleXMLElement $node) {
-		$logger = array();
-		
-		$name = $this->getAttributeValue($node, 'name');
-		if (empty($name)) {
-			$this->warn("A <logger> node is missing the required 'name' attribute. Skipping logger definition.");
-			return;
-		}
-		
-		if (isset($node->level)) {
-			$logger['level'] = $this->getAttributeValue($node->level, 'value');
-		}
-		
-		if (isset($node['additivity'])) {
-			$logger['additivity'] = $this->getAttributeValue($node, 'additivity');
-		}
-		
-		$logger['appenders'] = $this->parseAppenderReferences($node);
-
-		// Check for duplicate loggers
-		if (isset($this->config['loggers'][$name])) {
-			$this->warn("Duplicate logger definition [$name]. Overwriting.");
-		}
-		
-		$this->config['loggers'][$name] = $logger;
-	}
-	
-	/** 
-	 * Parses a <logger> node for appender references and returns them in an array.
-	 * 
-	 * Previous versions supported appender-ref, as well as appender_ref so both
-	 * are parsed for backward compatibility.
-	 */
-	private function parseAppenderReferences(SimpleXMLElement $node) {
-		$refs = array();
-		foreach($node->appender_ref as $ref) {
-			$refs[] = $this->getAttributeValue($ref, 'ref');
-		}
-		
-		foreach($node->{'appender-ref'} as $ref) {
-			$refs[] = $this->getAttributeValue($ref, 'ref');
-		}
-
-		return $refs;
-	}
-	
-	/** Parses a <filter> node. */
-	private function parseFilter($filterNode) {
-		$filter = array();
-		$filter['class'] = $this->getAttributeValue($filterNode, 'class');
-		
-		if (count($filterNode->param) > 0) {
-			$filter['params'] = $this->parseParameters($filterNode);
-		}
-		
-		return $filter;
-	}
-	
-	/** Parses a <renderer> node. */
-	private function parseRenderer(SimpleXMLElement $node) {
-		$renderedClass = $this->getAttributeValue($node, 'renderedClass');
-		$renderingClass = $this->getAttributeValue($node, 'renderingClass');
-		
-		$this->config['renderers'][] = compact('renderedClass', 'renderingClass');
-	}
-	
-	/** Parses a <defaultRenderer> node. */
-	private function parseDefaultRenderer(SimpleXMLElement $node) {
-		$renderingClass = $this->getAttributeValue($node, 'renderingClass');
-		
-		// Warn on duplicates
-		if(isset($this->config['defaultRenderer'])) {
-			$this->warn("Duplicate <defaultRenderer> node. Overwriting.");
-		}
-		
-		$this->config['defaultRenderer'] = $renderingClass; 
-	}
-	
-	// ******************************************
-	// ** Helper methods                       **
-	// ******************************************
-	
-	private function getAttributeValue(SimpleXMLElement $node, $name) {
-		return isset($node[$name]) ? (string) $node[$name] : null;
-	}
-	
-	private function warn($message) {
-		trigger_error("log4php: " . $message, E_USER_WARNING);
-	}
-}
-

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/configurators/LoggerConfiguratorDefault.php
----------------------------------------------------------------------
diff --git a/src/main/php/configurators/LoggerConfiguratorDefault.php b/src/main/php/configurators/LoggerConfiguratorDefault.php
deleted file mode 100644
index f78b797..0000000
--- a/src/main/php/configurators/LoggerConfiguratorDefault.php
+++ /dev/null
@@ -1,477 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *	   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @package log4php
- */
-
-/**
- * Default implementation of the logger configurator.
- * 
- * Configures log4php based on a provided configuration file or array.
- * 
- * @package log4php
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version $Revision$
- * @since 2.2
- */
-class LoggerConfiguratorDefault implements LoggerConfigurator
-{
-	/** XML configuration file format. */
-	const FORMAT_XML = 'xml';
-	
-	/** PHP configuration file format. */
-	const FORMAT_PHP = 'php';
-	
-	/** INI (properties) configuration file format. */
-	const FORMAT_INI = 'ini';
-
-	/** Defines which adapter should be used for parsing which format. */
-	private $adapters = array(
-		self::FORMAT_XML => 'LoggerConfigurationAdapterXML',
-		self::FORMAT_INI => 'LoggerConfigurationAdapterINI',
-		self::FORMAT_PHP => 'LoggerConfigurationAdapterPHP',
-	);
-	
-	/** Default configuration; used if no configuration file is provided. */
-	private static $defaultConfiguration = array(
-        'threshold' => 'ALL',
-        'rootLogger' => array(
-            'level' => 'DEBUG',
-            'appenders' => array('default'),
-        ),
-        'appenders' => array(
-            'default' => array(
-                'class' => 'LoggerAppenderEcho'
-            ),
-        ),
-	);
-	
-	/** Holds the appenders before they are linked to loggers. */
-	private $appenders = array();
-	
-	/**
-	 * Configures log4php based on the given configuration. The input can 
-	 * either be a path to the config file, or a PHP array holding the 
-	 * configuration. 
-	 * 
-	 * If no configuration is given, or if the given configuration cannot be
-	 * parsed for whatever reason, a warning will be issued, and log4php
-	 * will use the default configuration contained in 
-	 * {@link $defaultConfiguration}.
-	 * 
-	 * @param LoggerHierarchy $hierarchy The hierarchy on which to perform 
-	 * 		the configuration. 
-	 * @param string|array $input Either path to the config file or the 
-	 * 		configuration as an array. If not set, default configuration 
-	 * 		will be used.
-	 */
-	public function configure(LoggerHierarchy $hierarchy, $input = null) {
-		$config = $this->parse($input);
-		$this->doConfigure($hierarchy, $config);
-	}
-	
-	/**
-	 * Parses the given configuration and returns the parsed configuration
-	 * as a PHP array. Does not perform any configuration. 
-	 * 
-	 * If no configuration is given, or if the given configuration cannot be
-	 * parsed for whatever reason, a warning will be issued, and the default 
-	 * configuration will be returned ({@link $defaultConfiguration}).
-	 * 
-	 * @param string|array $input Either path to the config file or the 
-	 * 		configuration as an array. If not set, default configuration 
-	 * 		will be used.
-	 * @return array The parsed configuration.
-	 */
-	public function parse($input) {
-		// No input - use default configuration
-		if (!isset($input)) {
-			$config = self::$defaultConfiguration;
-		}
-		
-		// Array input - contains configuration within the array
-		else if (is_array($input)) {
-			$config = $input;
-		}
-		
-		// String input - contains path to configuration file
-		else if (is_string($input)) {
-			try {
-				$config = $this->parseFile($input);
-			} catch (LoggerException $e) {
-				$this->warn("Configuration failed. " . $e->getMessage() . " Using default configuration.");
-				$config = self::$defaultConfiguration;
-			}
-		}
-		
-		// Anything else is an error
-		else {
-			$this->warn("Invalid configuration param given. Reverting to default configuration.");
-			$config = self::$defaultConfiguration;
-		}
-		
-		return $config;
-	}
-
-	/** 
-	 * Returns the default log4php configuration.
-	 * @return array
-	 */
-	public static function getDefaultConfiguration() {
-		return self::$defaultConfiguration;
-	} 
-	
-	/**
-	 * Loads the configuration file from the given URL, determines which
-	 * adapter to use, converts the configuration to a PHP array and
-	 * returns it.
-	 *
-	 * @param string $url Path to the config file.
-	 * @return The configuration from the config file, as a PHP array.
-	 * @throws LoggerException If the configuration file cannot be loaded, or
-	 * 		if the parsing fails.
-	 */
-	private function parseFile($url) {
-		
-		if (!file_exists($url)) {
-			throw new LoggerException("File not found at [$url].");
-		}
-		
-		$type = $this->getConfigType($url);
-		$adapterClass = $this->adapters[$type];
-
-		$adapter = new $adapterClass();
-		return $adapter->convert($url);
-	}
-	
-	/** Determines configuration file type based on the file extension. */
-	private function getConfigType($url) {
-		$info = pathinfo($url);
-		$ext = strtolower($info['extension']);
-		
-		switch($ext) {
-			case 'xml':
-				return self::FORMAT_XML;
-			
-			case 'ini':
-			case 'properties':
-				return self::FORMAT_INI;
-			
-			case 'php':
-				return self::FORMAT_PHP;
-				
-			default:
-				throw new LoggerException("Unsupported configuration file extension: $ext");
-		}
-	}
-	
-	/**
-	 * Constructs the logger hierarchy based on configuration.
-	 * 
-	 * @param LoggerHierarchy $hierarchy
-	 * @param array $config
-	 */
-	private function doConfigure(LoggerHierarchy $hierarchy, $config) {
-		if (isset($config['threshold'])) {
-			$threshold = LoggerLevel::toLevel($config['threshold']);
-			if (isset($threshold)) {
-				$hierarchy->setThreshold($threshold);
-			} else {
-				$this->warn("Invalid threshold value [{$config['threshold']}] specified. Ignoring threshold definition.");
-			}
-		}
-		
-		// Configure appenders and add them to the appender pool
-		if (isset($config['appenders']) && is_array($config['appenders'])) {
-			foreach($config['appenders'] as $name => $appenderConfig) {
-				$this->configureAppender($name, $appenderConfig);
-			}
-		}
-		
-		// Configure root logger 
-		if (isset($config['rootLogger'])) {
-			$this->configureRootLogger($hierarchy, $config['rootLogger']);
-		}
-		
-		// Configure loggers
-		if (isset($config['loggers']) && is_array($config['loggers'])) {
-			foreach($config['loggers'] as $loggerName => $loggerConfig) {
-				$this->configureOtherLogger($hierarchy, $loggerName, $loggerConfig);
-			}
-		}
-
-		// Configure renderers
-		if (isset($config['renderers']) && is_array($config['renderers'])) {
-			foreach($config['renderers'] as $rendererConfig) {
-				$this->configureRenderer($hierarchy, $rendererConfig);
-			}
-		}
-		
-		if (isset($config['defaultRenderer'])) {
-			$this->configureDefaultRenderer($hierarchy, $config['defaultRenderer']);
-		}
-	}
-	
-	private function configureRenderer(LoggerHierarchy $hierarchy, $config) {
-		if (empty($config['renderingClass'])) {
-			$this->warn("Rendering class not specified. Skipping renderer definition.");
-			return;
-		}
-		
-		if (empty($config['renderedClass'])) {
-			$this->warn("Rendered class not specified. Skipping renderer definition.");
-			return;
-		}
-		
-		// Error handling performed by RendererMap
-		$hierarchy->getRendererMap()->addRenderer($config['renderedClass'], $config['renderingClass']);
-	}
-	
-	private function configureDefaultRenderer(LoggerHierarchy $hierarchy, $class) {
-		if (empty($class)) {
-			$this->warn("Rendering class not specified. Skipping default renderer definition.");
-			return;
-		}
-		
-		// Error handling performed by RendererMap
-		$hierarchy->getRendererMap()->setDefaultRenderer($class);
-	}
-	
-	/** 
-	 * Configures an appender based on given config and saves it to 
-	 * {@link $appenders} array so it can be later linked to loggers. 
-	 * @param string $name Appender name. 
-	 * @param array $config Appender configuration options.
-	 */
-	private function configureAppender($name, $config) {
-
-		// TODO: add this check to other places where it might be useful
-		if (!is_array($config)) {
-			$type = gettype($config);
-			$this->warn("Invalid configuration provided for appender [$name]. Expected an array, found <$type>. Skipping appender definition.");
-			return;
-		}
-		
-		// Parse appender class
-		$class = $config['class'];
-		if (empty($class)) {
-			$this->warn("No class given for appender [$name]. Skipping appender definition.");
-			return;
-		}
-		if (!class_exists($class)) {
-			$this->warn("Invalid class [$class] given for appender [$name]. Class does not exist. Skipping appender definition.");
-			return;
-		}
-		
-		// Instantiate the appender
-		$appender = new $class($name);
-		if (!($appender instanceof LoggerAppender)) {
-			$this->warn("Invalid class [$class] given for appender [$name]. Not a valid LoggerAppender class. Skipping appender definition.");
-			return;
-		}
-		
-		// Parse the appender threshold
-		if (isset($config['threshold'])) {
-			$threshold = LoggerLevel::toLevel($config['threshold']);
-			if ($threshold instanceof LoggerLevel) {
-				$appender->setThreshold($threshold);
-			} else {
-				$this->warn("Invalid threshold value [{$config['threshold']}] specified for appender [$name]. Ignoring threshold definition.");
-			}
-		}
-		
-		// Parse the appender layout
-		if ($appender->requiresLayout() && isset($config['layout'])) {
-			$this->createAppenderLayout($appender, $config['layout']);
-		}
-		
-		// Parse filters
-		if (isset($config['filters']) && is_array($config['filters'])) {
-			foreach($config['filters'] as $filterConfig) {
-				$this->createAppenderFilter($appender, $filterConfig);
-			}
-		}
-		
-		// Set options if any
-		if (isset($config['params'])) {
-			$this->setOptions($appender, $config['params']);
-		}
-
-		// Activate and save for later linking to loggers
-		$appender->activateOptions();
-		$this->appenders[$name] = $appender;
-	}
-	
-	/**
-	 * Parses layout config, creates the layout and links it to the appender.
-	 * @param LoggerAppender $appender
-	 * @param array $config Layout configuration.
-	 */
-	private function createAppenderLayout(LoggerAppender $appender, $config) {
-		$name = $appender->getName();
-		$class = $config['class'];
-		if (empty($class)) {
-			$this->warn("Layout class not specified for appender [$name]. Reverting to default layout.");
-			return;
-		}
-		if (!class_exists($class)) {
-			$this->warn("Nonexistant layout class [$class] specified for appender [$name]. Reverting to default layout.");
-			return;
-		}
-		
-		$layout = new $class();
-		if (!($layout instanceof LoggerLayout)) {
-			$this->warn("Invalid layout class [$class] sepcified for appender [$name]. Reverting to default layout.");
-			return;
-		}
-		
-		if (isset($config['params'])) {
-			$this->setOptions($layout, $config['params']);
-		}
-		
-		$layout->activateOptions();
-		$appender->setLayout($layout);
-	}
-	
-	/**
-	 * Parses filter config, creates the filter and adds it to the appender's 
-	 * filter chain.
-	 * @param LoggerAppender $appender
-	 * @param array $config Filter configuration.
-	 */
-	private function createAppenderFilter(LoggerAppender $appender, $config) {
-		$name = $appender->getName();
-		$class = $config['class'];
-		if (!class_exists($class)) {
-			$this->warn("Nonexistant filter class [$class] specified on appender [$name]. Skipping filter definition.");
-			return;
-		}
-	
-		$filter = new $class();
-		if (!($filter instanceof LoggerFilter)) {
-			$this->warn("Invalid filter class [$class] sepcified on appender [$name]. Skipping filter definition.");
-			return;
-		}
-	
-		if (isset($config['params'])) {
-			$this->setOptions($filter, $config['params']);
-		}
-	
-		$filter->activateOptions();
-		$appender->addFilter($filter);
-	}
-	
-	/** 
-	 * Configures the root logger
-	 * @see configureLogger() 
-	 */
-	private function configureRootLogger(LoggerHierarchy $hierarchy, $config) {
-		$logger = $hierarchy->getRootLogger();
-		$this->configureLogger($logger, $config);
-	}
-
-	/**
-	 * Configures a logger which is not root.
-	 * @see configureLogger()
-	 */
-	private function configureOtherLogger(LoggerHierarchy $hierarchy, $name, $config) {
-		// Get logger from hierarchy (this creates it if it doesn't already exist)
-		$logger = $hierarchy->getLogger($name);
-		$this->configureLogger($logger, $config);
-	}
-	
-	/**
-	 * Configures a logger. 
-	 * 
-	 * @param Logger $logger The logger to configure
-	 * @param array $config Logger configuration options.
-	 */
-	private function configureLogger(Logger $logger, $config) {
-		$loggerName = $logger->getName();
-		
-		// Set logger level
-		if (isset($config['level'])) {
-			$level = LoggerLevel::toLevel($config['level']);
-			if (isset($level)) {
-				$logger->setLevel($level);
-			} else {
-				$this->warn("Invalid level value [{$config['level']}] specified for logger [$loggerName]. Ignoring level definition.");
-			}
-		}
-		
-		// Link appenders to logger
-		if (isset($config['appenders'])) {
-			foreach($config['appenders'] as $appenderName) {
-				if (isset($this->appenders[$appenderName])) {
-					$logger->addAppender($this->appenders[$appenderName]);
-				} else {
-					$this->warn("Nonexistnant appender [$appenderName] linked to logger [$loggerName].");
-				}
-			}
-		}
-		
-		// Set logger additivity
-		if (isset($config['additivity'])) {
-			try {
-				$additivity = LoggerOptionConverter::toBooleanEx($config['additivity'], null);
-				$logger->setAdditivity($additivity);
-			} catch (Exception $ex) {
-				$this->warn("Invalid additivity value [{$config['additivity']}] specified for logger [$loggerName]. Ignoring additivity setting.");
-			}
-		}
-	}
-
-	/**
-	 * Helper method which applies given options to an object which has setters
-	 * for these options (such as appenders, layouts, etc.).
-	 * 
-	 * For example, if options are:
-	 * <code>
-	 * array(
-	 * 	'file' => '/tmp/myfile.log',
-	 * 	'append' => true
-	 * )
-	 * </code>
-	 * 
-	 * This method will call:
-	 * <code>
-	 * $object->setFile('/tmp/myfile.log')
-	 * $object->setAppend(true)
-	 * </code>
-	 * 
-	 * If required setters do not exist, it will produce a warning. 
-	 * 
-	 * @param mixed $object The object to configure.
-	 * @param unknown_type $options
-	 */
-	private function setOptions($object, $options) {
-		foreach($options as $name => $value) {
-			$setter = "set$name";
-			if (method_exists($object, $setter)) {
-				$object->$setter($value);
-			} else {
-				$class = get_class($object);
-				$this->warn("Nonexistant option [$name] specified on [$class]. Skipping.");
-			}
-		}
-	}
-	
-	/** Helper method to simplify error reporting. */
-	private function warn($message) {
-		trigger_error("log4php: $message", E_USER_WARNING);
-	}
-}

http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/79ed2d0d/src/main/php/filters/LoggerFilterDenyAll.php
----------------------------------------------------------------------
diff --git a/src/main/php/filters/LoggerFilterDenyAll.php b/src/main/php/filters/LoggerFilterDenyAll.php
deleted file mode 100644
index c8c73fa..0000000
--- a/src/main/php/filters/LoggerFilterDenyAll.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *	   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @package log4php
- */
-
-/**
- * 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$
- * @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;
-	}
-}