Home » Logging » Log » Bug #5192
Method getIdent returns nothing for Composite Log
Details
| Submitted | 2005-08-24 00:24 UTC |
|---|---|
| From | rex at seas dot ucla dot edu |
| Assigned | jon |
| Status | Closed |
| Package | Log |
| PHP Version | 5.0.0 |
| OS | Solaris |
| Roadmaps | (Not assigned) |
Comments
[2005-08-24 00:24 UTC] rex at seas dot ucla dot edu
Description:
------------
When using a Composite Log object, I am unable to get a result for the getIdent method. I am successfully able to call the setIdent method, because the string entered appears in the log output.
I took at look at /pear/Log/Log/composite.php and noticed that the method setIdent was changed to handle the composite of logging objects, but getIdent was never redefined.
Can something like this patch be inserted into the code?
/**
* Gets the identification string of this composite object
* from one of the children
*
* @access public
* @since Log <new_version>
*/
function getIdent()
{
foreach ($this->_children as $id => $child) {
return $this->_children[$id]->getIdent($ident);
}
}
Test script:
---------------
// set up PEAR:Log
$console =& Log::singleton('console', '', '', null, PEAR_LOG_NOTICE);
$file =& Log::singleton('file', 'test.log', '', null, PEAR_LOG_DEBUG);
$logger =& Log::singleton('composite');
$logger->addChild($console);
$logger->addChild($file);
$logger->setIdent('TEST');
$ident = $logger->getIdent();
echo $ident;
Expected result:
----------------
TEST
Actual result:
--------------
Nothing, empty string.