Passing an instance of a configurator class to the Logger::configure function
gives an error
--------------------------------------------------------------------------------------------
Key: LOG4PHP-168
URL: https://issues.apache.org/jira/browse/LOG4PHP-168
Project: Log4php
Issue Type: Bug
Components: Code
Affects Versions: 2.0
Environment: Mac 10.6.8, PHP 5.3.6, Log4php v2.0 from the PEAR
repository.
Reporter: Emmet O'Grady
I get the following error when I try to pass a configurator object to the
Logger::configure() function:
PHP Warning: class_exists() expects parameter 1 to be string, object given in
/var/pear/share/pear/log4php/Logger.php on line 586
The function where this error is happening is the following:
/**
* Creates a logger configurator instance based on the provided
* configurator class. If no class is given, returns an instance of
* the default configurator.
*
* @param string $configuratorClass The configurator class.
*/
private static function getConfigurator($configuratorClass = null) {
if (empty($configuratorClass)) {
return new LoggerConfiguratorDefault();
}
if (!class_exists($configuratorClass)) {
$this->warn("Specified configurator class
[$configuratorClass] does not exist. Reverting to default configurator.");
return new LoggerConfiguratorDefault();
}
$configurator = new $configuratorClass();
if (!($configurator instanceof LoggerConfigurator)) {
$this->warn("Specified configurator class
[$configuratorClass] does not implement the LoggerConfigurator interface.
Reverting to default configurator.");
return new LoggerConfiguratorDefault();
}
return $configurator;
}
I believe that there is a newer release of Log4php already out. If this bug is
fixed in the new release then maybe it's time to update the PEAR repo.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira