Edit report at http://pear.php.net/bugs/bug.php?id=16452&edit=1
ID: 16452
Comment by: [email protected]
Reported By: pim at lemonbit dot com
Summary: Shortcut log methods log class name incorrectly
Status: Open
Type: Bug
Package: Log
Operating System: Mac OS X
Package Version: 1.11.4
PHP Version: 5.2.5
Roadmap Versions:
New Comment:
Please note: In contrary to the script example I have found this bug
using a composite handler!
Previous Comments:
------------------------------------------------------------------------
[2009-07-18 20:40:55] prupert
Description:
------------
the shortcut methods to log an event (such as debug(), info(), alert())
don't log the correct class name where the event occured. In stead, they
log their 'self' class name "Log". The name of the function/method
however does get logged correctly.
Test script:
---------------
class MyClass {
function myFunction {
/* Start a log instance with the class name displayed */
$options = array('lineFormat' => '%4$s (%8$s::%7$s)');
$logger = &Log::singleton('display', '', '', $options);
/* Log an event using log() */
$logger->log('This will be logged correctly with the class name
MyClass in the log event details.');
/* Log an event using the shortcut info() */
$logger->info('This will be logged incorrectly, MyClass is not
logged as the class name!');
}
}
Expected result:
----------------
The output using '%4$s (%8$s::%7$s)' as the lineFormat should be
"Message (MyClass::myFunction)".
Actual result:
--------------
The actual output using info() (or any other shortcut log method) is
incorrect: "Message (Log::myFunction)".
------------------------------------------------------------------------