You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by gr...@apache.org on 2010/01/29 08:27:22 UTC
svn commit: r904398 - in /incubator/log4php/trunk/src: changes/changes.xml
main/php/LoggerLoggingEvent.php
main/php/helpers/LoggerClassNamePatternConverter.php
test/php/helpers/LoggerPatternParserTest.php
Author: grobmeier
Date: Fri Jan 29 07:27:19 2010
New Revision: 904398
URL: http://svn.apache.org/viewvc?rev=904398&view=rev
Log:
applied slightly modfied patch from Hiroaki Kawai (LOG4PHP-93): LoggerClassNamePatternConverter accessing private property
Modified:
incubator/log4php/trunk/src/changes/changes.xml
incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php
incubator/log4php/trunk/src/main/php/helpers/LoggerClassNamePatternConverter.php
incubator/log4php/trunk/src/test/php/helpers/LoggerPatternParserTest.php
Modified: incubator/log4php/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/changes/changes.xml?rev=904398&r1=904397&r2=904398&view=diff
==============================================================================
--- incubator/log4php/trunk/src/changes/changes.xml (original)
+++ incubator/log4php/trunk/src/changes/changes.xml Fri Jan 29 07:27:19 2010
@@ -25,7 +25,7 @@
<body>
<release version="2.1" description="Stabilizing">
<action type="fix" issue="LOG4PHP-91">LoginOptionConverter.php (used wrong constant name)</action>
- <action type="fix" issue="LOG4PHP-96" by="Tommy Montgomery">Some of the tests don't pass under Windows</action>
+y <action type="fix" issue="LOG4PHP-96" by="Tommy Montgomery">Some of the tests don't pass under Windows</action>
</release>
<release version="2.0" description="PHP 5 compatibility">
<action type="fix" issue="LOG4PHP-3">Maven 2.0 build</action>
Modified: incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php?rev=904398&r1=904397&r2=904398&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php (original)
+++ incubator/log4php/trunk/src/main/php/LoggerLoggingEvent.php Fri Jan 29 07:27:19 2010
@@ -145,6 +145,14 @@
}
/**
+ * Returns the full qualified classname.
+ * TODO: PHP does contain namespaces in 5.3. Those should be returned too,
+ */
+ public function getFullQualifiedClassname() {
+ return $this->fqcn;
+ }
+
+ /**
* Set the location information for this logging event. The collected
* information is cached for future use.
*
Modified: incubator/log4php/trunk/src/main/php/helpers/LoggerClassNamePatternConverter.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/helpers/LoggerClassNamePatternConverter.php?rev=904398&r1=904397&r2=904398&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/helpers/LoggerClassNamePatternConverter.php (original)
+++ incubator/log4php/trunk/src/main/php/helpers/LoggerClassNamePatternConverter.php Fri Jan 29 07:27:19 2010
@@ -39,7 +39,7 @@
* @return string
*/
public function getFullyQualifiedName($event) {
- return $event->fqcn;
+ return $event->getFullQualifiedClassname();
}
}
Modified: incubator/log4php/trunk/src/test/php/helpers/LoggerPatternParserTest.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/test/php/helpers/LoggerPatternParserTest.php?rev=904398&r1=904397&r2=904398&view=diff
==============================================================================
--- incubator/log4php/trunk/src/test/php/helpers/LoggerPatternParserTest.php (original)
+++ incubator/log4php/trunk/src/test/php/helpers/LoggerPatternParserTest.php Fri Jan 29 07:27:19 2010
@@ -26,14 +26,26 @@
// TODO: Should also test complex patterns like: "%d{Y-m-d H:i:s} %-5p %c %X{username}: %m in %F at %L%n"
class LoggerPatternParserTest extends PHPUnit_Framework_TestCase {
- public function testErrorLayout() {
+ public function testErrorLayout() {
$event = new LoggerLoggingEvent("LoggerLayoutXml", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
- $e = 'ERROR TEST : testmessage in NA at NA'.PHP_EOL;
+ $expected = 'ERROR TEST : testmessage in NA at NA'.PHP_EOL;
$patternParser = new LoggerPatternParser("%-5p %c %X{username}: %m in %F at %L%n");
$c = $patternParser->parse();
- $c->format($e, $event);
+ $actual = '';
+ $c->format($actual, $event);
+// self::assertEquals($expected, $actual);
}
+
+ public function testClassname() {
+ $event = new LoggerLoggingEvent("MyClass", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
+ $expected = 'MyClass';
+ $patternParser = new LoggerPatternParser("%C");
+ $c = $patternParser->parse();
+ $actual = '';
+ $c->format($actual, $event);
+ self::assertEquals($expected, $actual);
+ }
}