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 2011/09/21 07:43:15 UTC
svn commit: r1173501 - in
/logging/log4php/branches/experimental/config-adapters/src: main/php/
main/php/appenders/ main/php/xml/ test/php/appenders/ test/php/configurators/
Author: ihabunek
Date: Wed Sep 21 05:43:15 2011
New Revision: 1173501
URL: http://svn.apache.org/viewvc?rev=1173501&view=rev
Log:
Minor improvements, started work on tests.
Modified:
logging/log4php/branches/experimental/config-adapters/src/main/php/LoggerConfigurator.php
logging/log4php/branches/experimental/config-adapters/src/main/php/appenders/LoggerAppenderConsole.php
logging/log4php/branches/experimental/config-adapters/src/main/php/xml/log4php.xsd
logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderConsoleTest.php
logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderEchoTest.php
logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderFileTest.php
logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderPhpTest.php
logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterINITest.php
logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterPHPTest.php
logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterXMLTest.php
logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/config2.ini
Modified: logging/log4php/branches/experimental/config-adapters/src/main/php/LoggerConfigurator.php
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/main/php/LoggerConfigurator.php?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/main/php/LoggerConfigurator.php (original)
+++ logging/log4php/branches/experimental/config-adapters/src/main/php/LoggerConfigurator.php Wed Sep 21 05:43:15 2011
@@ -261,6 +261,11 @@ class LoggerConfigurator
if ($appender->requiresLayout() && isset($config['layout'])) {
$this->createAppenderLayout($appender, $config['layout']);
}
+
+ // Set options if any
+ if (isset($config['params'])) {
+ $this->setOptions($appender, $config['params']);
+ }
// Activate and save for later linking to loggers
$appender->activateOptions();
@@ -286,8 +291,10 @@ class LoggerConfigurator
return;
}
- unset($config['class']);
- $this->setOptions($layout, $config);
+ if (isset($config['params'])) {
+ $this->setOptions($layout, $config['params']);
+ }
+
$layout->activateOptions();
$appender->setLayout($layout);
Modified: logging/log4php/branches/experimental/config-adapters/src/main/php/appenders/LoggerAppenderConsole.php
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/main/php/appenders/LoggerAppenderConsole.php?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/main/php/appenders/LoggerAppenderConsole.php (original)
+++ logging/log4php/branches/experimental/config-adapters/src/main/php/appenders/LoggerAppenderConsole.php Wed Sep 21 05:43:15 2011
@@ -74,6 +74,10 @@ class LoggerAppenderConsole extends Logg
$this->target = self::STDERR;
}
}
+
+ public function getTarget() {
+ return $this->target;
+ }
public function activateOptions() {
$this->fp = fopen($this->target, 'w');
Modified: logging/log4php/branches/experimental/config-adapters/src/main/php/xml/log4php.xsd
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/main/php/xml/log4php.xsd?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/main/php/xml/log4php.xsd (original)
+++ logging/log4php/branches/experimental/config-adapters/src/main/php/xml/log4php.xsd Wed Sep 21 05:43:15 2011
@@ -5,6 +5,11 @@
xmlns="http://logging.apache.org/log4php">
<xs:element name="configuration">
+ <xs:annotation>
+ <xs:documentation>
+ The root element for Apache log4php configuration.
+ </xs:documentation>
+ </xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="renderer" />
@@ -12,13 +17,30 @@
<xs:element minOccurs="0" maxOccurs="unbounded" ref="logger" />
<xs:element minOccurs="0" ref="root" />
</xs:sequence>
- <xs:attribute name="threshold" type="level" default="null" />
+ <xs:attribute name="threshold" type="threshold" default="all" />
</xs:complexType>
</xs:element>
<xs:element name="renderer">
- <xs:complexType>
- <xs:attribute name="renderedClass" use="required" />
- <xs:attribute name="renderingClass" use="required" />
+ <xs:annotation>
+ <xs:documentation>
+ Defines a renderer.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:attribute name="renderedClass" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ Name of the class which will be rendered by this renderer.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="renderingClass" use="required">
+ <xs:annotation>
+ <xs:documentation>
+ Name of the class which perform the rendering. Must implement LoggerRendererObject interface.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="appender">
@@ -142,7 +164,7 @@
<!-- Types -->
<!-- ============================================== -->
- <xs:simpleType name="level">
+ <xs:simpleType name="threshold">
<xs:restriction base="xs:token">
<xs:enumeration value="all" />
<xs:enumeration value="debug" />
@@ -151,7 +173,17 @@
<xs:enumeration value="error" />
<xs:enumeration value="fatal" />
<xs:enumeration value="off" />
- <xs:enumeration value="null" />
</xs:restriction>
</xs:simpleType>
+
+ <xs:simpleType name="level">
+ <xs:restriction base="threshold">
+ <xs:enumeration value="debug" />
+ <xs:enumeration value="info" />
+ <xs:enumeration value="warn" />
+ <xs:enumeration value="error" />
+ <xs:enumeration value="fatal" />
+ </xs:restriction>
+ </xs:simpleType>
+
</xs:schema>
Modified: logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderConsoleTest.php
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderConsoleTest.php?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderConsoleTest.php (original)
+++ logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderConsoleTest.php Wed Sep 21 05:43:15 2011
@@ -30,50 +30,63 @@
* to work for fwrite(STDOUT, ...)
*/
class LoggerAppenderConsoleTest extends PHPUnit_Framework_TestCase {
-
- private $event;
- public function setUp()
- {
- $logger = new Logger('mycategory');
- $level = LoggerLevel::getLevelWarn();
- $this->event = new LoggerLoggingEvent(__CLASS__, $logger, $level, "my message");
- }
+ private $config = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'LoggerAppenderConsole',
+ 'layout' => array(
+ 'class' => 'LoggerLayoutPattern',
+ 'params' => array(
+ 'conversionPattern' => ''
+ )
+ ),
+ )
+ )
+ );
public function testRequiresLayout() {
$appender = new LoggerAppenderConsole();
self::assertTrue($appender->requiresLayout());
}
- public function testSimpleStdOutLogging() {
- $layout = new LoggerLayoutSimple();
+ public function testAppendDefault() {
+ Logger::configure($this->config);
+ $log = Logger::getRootLogger();
+
+ $expected = LoggerAppenderConsole::STDOUT;
+ $actual = $log->getAppender('default')->getTarget();
+ $this->assertSame($expected, $actual);
- $appender = new LoggerAppenderConsole("mylogger");
- $appender->setTarget('STDOUT');
- $appender->setLayout($layout);
- $appender->activateOptions();
- $appender->append($this->event);
- $appender->close();
+ $log->info("hello");
}
- public function testSimpleStdErrLogging() {
- $layout = new LoggerLayoutSimple();
+ public function testAppendStdout() {
+ $this->config['appenders']['default']['params']['target'] = 'stdout';
- $appender = new LoggerAppenderConsole("mylogger");
- $appender->setTarget('STDERR');
- $appender->setLayout($layout);
- $appender->activateOptions();
- $appender->append($this->event);
- $appender->close();
- }
-
- public function testSimpleDefaultLogging() {
- $layout = new LoggerLayoutSimple();
+ Logger::configure($this->config);
+ $log = Logger::getRootLogger();
+
+ $expected = LoggerAppenderConsole::STDOUT;
+ $actual = $log->getAppender('default')->getTarget();
+ $this->assertSame($expected, $actual);
+
+ $log->info("hello");
+ }
+
+ public function testAppendStderr() {
+ $this->config['appenders']['default']['params']['target'] = 'stderr';
- $appender = new LoggerAppenderConsole("mylogger");
- $appender->setLayout($layout);
- $appender->activateOptions();
- $appender->append($this->event);
- $appender->close();
+ Logger::configure($this->config);
+ $log = Logger::getRootLogger();
+ $expected = LoggerAppenderConsole::STDERR;
+
+ $actual = $log->getAppender('default')->getTarget();
+ $this->assertSame($expected, $actual);
+
+ $log->info("hello");
}
}
Modified: logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderEchoTest.php
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderEchoTest.php?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderEchoTest.php (original)
+++ logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderEchoTest.php Wed Sep 21 05:43:15 2011
@@ -28,6 +28,91 @@
*/
class LoggerAppenderEchoTest extends PHPUnit_Framework_TestCase {
+ private $config1 = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'LoggerAppenderEcho',
+ 'layout' => array(
+ 'class' => 'LoggerLayoutSimple'
+ ),
+ )
+ )
+ );
+
+ private $config2 = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'LoggerAppenderEcho',
+ 'layout' => array(
+ 'class' => 'LoggerLayoutSimple'
+ ),
+ 'params' => array(
+ 'htmlLineBreaks' => true
+ )
+ )
+ )
+ );
+
+ private $config3 = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'LoggerAppenderEcho',
+ 'layout' => array(
+ 'class' => 'LoggerLayoutSimple'
+ ),
+ 'params' => array(
+ 'htmlLineBreaks' => 'foo'
+ )
+ )
+ )
+ );
+
+ public function testAppend() {
+ Logger::configure($this->config1);
+ $log = Logger::getRootLogger();
+
+ $hlb = $log->getAppender('default')->getHtmlLineBreaks();
+ $this->assertSame(false, $hlb);
+
+ ob_start();
+ $log->info("This is a test");
+ $log->debug("And this too");
+ $actual = ob_get_clean();
+ $expected = "INFO - This is a test" . PHP_EOL . "DEBUG - And this too". PHP_EOL;
+
+ $this->assertSame($expected, $actual);
+ }
+
+ public function testHtmlLineBreaks() {
+ Logger::configure($this->config2);
+ $log = Logger::getRootLogger();
+
+ $hlb = $log->getAppender('default')->getHtmlLineBreaks();
+ $this->assertSame(true, $hlb);
+
+ ob_start();
+ $log->info("This is a test" . PHP_EOL . "With more than one line");
+ $log->debug("And this too");
+ $actual = ob_get_clean();
+ $expected = "INFO - This is a test<br />" . PHP_EOL . "With more than one line<br />" . PHP_EOL . "DEBUG - And this too<br />" . PHP_EOL;
+
+ $this->assertSame($expected, $actual);
+ }
+
+// public function testHtmlLineBreaksInvalidOption() {
+// Logger::configure($this->config3);
+// }
+
+
public function testEcho() {
$appender = new LoggerAppenderEcho("myname ");
Modified: logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderFileTest.php
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderFileTest.php?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderFileTest.php (original)
+++ logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderFileTest.php Wed Sep 21 05:43:15 2011
@@ -7,7 +7,7 @@
* (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
+ * 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,
@@ -16,58 +16,109 @@
* limitations under the License.
*
* @category tests
- * @package log4php
+ * @package log4php
* @subpackage appenders
- * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
- * @version SVN: $Id$
- * @link http://logging.apache.org/log4php
+ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+ * @version SVN: $Id$
+ * @link http://logging.apache.org/log4php
*/
/**
* @group appenders
*/
class LoggerAppenderFileTest extends PHPUnit_Framework_TestCase {
-
+
+ private $config1 = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'LoggerAppenderFile',
+ 'layout' => array(
+ 'class' => 'LoggerLayoutSimple'
+ ),
+ 'params' => array()
+ )
+ )
+ );
+
private $testPath;
public function __construct() {
- $this->testPath = dirname(__FILE__) . '/../../../../target/temp/phpunit/TEST.txt';
+ $this->testPath = PHPUNIT_TEMP_DIR . '/TEST.txt';
+
+ if (is_dir(PHPUNIT_TEMP_DIR)) {
+ rmdir(PHPUNIT_TEMP_DIR);
+ }
+ }
+
+ public function setUp() {
+ Logger::resetConfiguration();
+ if(file_exists($this->testPath)) {
+ unlink($this->testPath);
+ }
+ }
+
+ public function tearDown() {
+ Logger::resetConfiguration();
+ if(file_exists($this->testPath)) {
+ unlink($this->testPath);
+ }
}
- protected function setUp() {
- if(file_exists($this->testPath)) {
- unlink($this->testPath);
- }
- }
-
public function testRequiresLayout() {
$appender = new LoggerAppenderFile();
self::assertTrue($appender->requiresLayout());
}
- public function testSimpleLogging() {
- $layout = new LoggerLayoutSimple();
-
- $event = new LoggerLoggingEvent('LoggerAppenderFileTest',
- new Logger('mycategory'),
- LoggerLevel::getLevelWarn(),
- "my message");
-
- $appender = new LoggerAppenderFile("mylogger");
- $appender->setFile($this->testPath);
- $appender->setLayout($layout);
- $appender->activateOptions();
- $appender->append($event);
- $appender->close();
-
- $v = file_get_contents($this->testPath);
- $e = "WARN - my message".PHP_EOL;
- self::assertEquals($e, $v);
- }
-
- protected function tearDown() {
- if(file_exists($this->testPath)) {
- unlink($this->testPath);
- }
- }
+ public function testSimpleLogging() {
+ $config = $this->config1;
+ $config['appenders']['default']['params']['file'] = $this->testPath;
+
+ Logger::configure($config);
+
+ $logger = Logger::getRootLogger();
+ $logger->info('This is a test');
+
+ $expected = "INFO - This is a test" . PHP_EOL;
+ $actual = file_get_contents($this->testPath);
+ $this->assertSame($expected, $actual);
+ }
+
+ public function testAppendFlagTrue() {
+ $config = $this->config1;
+ $config['appenders']['default']['params']['file'] = $this->testPath;
+ $config['appenders']['default']['params']['append'] = true;
+
+ Logger::configure($config);
+ $logger = Logger::getRootLogger();
+ $logger->info('This is a test');
+
+ Logger::configure($config);
+ $logger = Logger::getRootLogger();
+ $logger->info('This is a test');
+
+ $expected = "INFO - This is a test" . PHP_EOL . "INFO - This is a test" . PHP_EOL;
+ $actual = file_get_contents($this->testPath);
+ $this->assertSame($expected, $actual);
+ }
+
+ public function testAppendFlagFalse() {
+ $config = $this->config1;
+ $config['appenders']['default']['params']['file'] = $this->testPath;
+ $config['appenders']['default']['params']['append'] = false;
+
+ Logger::configure($config);
+ $logger = Logger::getRootLogger();
+ $logger->info('This is a test');
+
+ Logger::configure($config);
+ $logger = Logger::getRootLogger();
+ $logger->info('This is a test');
+
+ $expected = "INFO - This is a test" . PHP_EOL;
+ $actual = file_get_contents($this->testPath);
+ $this->assertSame($expected, $actual);
+ }
}
Modified: logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderPhpTest.php
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderPhpTest.php?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderPhpTest.php (original)
+++ logging/log4php/branches/experimental/config-adapters/src/test/php/appenders/LoggerAppenderPhpTest.php Wed Sep 21 05:43:15 2011
@@ -24,49 +24,71 @@
*/
function errorHandler($errno, $errstr, $errfile, $errline) {
- switch ($errno) {
- case E_USER_ERROR:
- PHPUnit_Framework_TestCase::assertEquals($errstr, "ERROR - testmessage".PHP_EOL);
- break;
- case E_USER_WARNING:
- PHPUnit_Framework_TestCase::assertEquals($errstr, "WARN - testmessage".PHP_EOL);
- break;
- case E_USER_NOTICE:
- PHPUnit_Framework_TestCase::assertEquals($errstr, "DEBUG - testmessage".PHP_EOL);
- break;
- default:
- PHPUnit_Framework_TestCase::assertTrue(false);
- }
+ PHPUnit_Framework_TestCase::assertEquals(LoggerAppenderPhpTest::$expectedError, $errno);
+ PHPUnit_Framework_TestCase::assertEquals(LoggerAppenderPhpTest::$expectedMessage, $errstr);
}
-
/**
* @group appenders
*/
class LoggerAppenderPhpTest extends PHPUnit_Framework_TestCase {
+
+ public static $expectedMessage;
+
+ public static $expectedError;
+
+ private $config = array(
+ 'rootLogger' => array(
+ 'appenders' => array('default'),
+ 'level' => 'trace'
+ ),
+ 'appenders' => array(
+ 'default' => array(
+ 'class' => 'LoggerAppenderPHP',
+ 'layout' => array(
+ 'class' => 'LoggerLayoutSimple'
+ ),
+ )
+ )
+ );
+
protected function setUp() {
set_error_handler("errorHandler");
}
-
+
public function testRequiresLayout() {
$appender = new LoggerAppenderPhp();
- self::assertTrue($appender->requiresLayout());
+ $this->assertTrue($appender->requiresLayout());
}
public function testPhp() {
- $appender = new LoggerAppenderPhp("TEST");
+ Logger::configure($this->config);
+ $logger = Logger::getRootLogger();
+
+
+ self::$expectedError = E_USER_ERROR;
+ self::$expectedMessage = "FATAL - This is a test" . PHP_EOL;
+ $logger->fatal("This is a test");
+
+ self::$expectedError = E_USER_ERROR;
+ self::$expectedMessage = "ERROR - This is a test" . PHP_EOL;
+ $logger->error("This is a test");
+
+ self::$expectedError = E_USER_WARNING;
+ self::$expectedMessage = "WARN - This is a test" . PHP_EOL;
+ $logger->warn("This is a test");
- $layout = new LoggerLayoutSimple();
- $appender->setLayout($layout);
- $appender->activateOptions();
- $event = new LoggerLoggingEvent("LoggerAppenderPhpTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
- $appender->append($event);
+ self::$expectedError = E_USER_NOTICE;
+ self::$expectedMessage = "INFO - This is a test" . PHP_EOL;
+ $logger->info("This is a test");
- $event = new LoggerLoggingEvent("LoggerAppenderPhpTest", new Logger("TEST"), LoggerLevel::getLevelWarn(), "testmessage");
- $appender->append($event);
+ self::$expectedError = E_USER_NOTICE;
+ self::$expectedMessage = "DEBUG - This is a test" . PHP_EOL;
+ $logger->debug("This is a test");
- $event = new LoggerLoggingEvent("LoggerAppenderPhpTest", new Logger("TEST"), LoggerLevel::getLevelDebug(), "testmessage");
- $appender->append($event);
+ self::$expectedError = E_USER_NOTICE;
+ self::$expectedMessage = "TRACE - This is a test" . PHP_EOL;
+ $logger->trace("This is a test");
}
protected function tearDown() {
Modified: logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterINITest.php
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterINITest.php?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterINITest.php (original)
+++ logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterINITest.php Wed Sep 21 05:43:15 2011
@@ -1,4 +1,22 @@
<?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
+ */
/**
* @group configurators
@@ -83,7 +101,7 @@ class LoggerConfigurationAdapterINITest
/**
* Test exception is thrown when file is not a valid ini file.
* @expectedException LoggerException
- * @expectedExceptionMessage Error parsing configuration file: syntax error, unexpected $end
+ * @expectedExceptionMessage Error parsing configuration file: syntax error
*/
public function testInvalidFileException() {
$url = dirname(__FILE__) . '/config2.ini';
@@ -92,10 +110,10 @@ class LoggerConfigurationAdapterINITest
}
/**
- * Test a warning is triggered when configurator doesn't understand a line.
- * @expectedException PHPUnit_Framework_Error
- * @expectedExceptionMessage log4php: Don't know how to parse the following line: "log4php.appender.default.layout.param.bla = LoggerLayoutTTCC". Skipping.
- */
+ * Test a warning is triggered when configurator doesn't understand a line.
+ * @expectedException PHPUnit_Framework_Error
+ * @expectedExceptionMessage log4php: Don't know how to parse the following line: "log4php.appender.default.layout.param.bla = LoggerLayoutTTCC". Skipping.
+ */
public function testInvalidLineWarning1() {
$url = dirname(__FILE__) . '/config3.ini';
$adapter = new LoggerConfigurationAdapterINI();
@@ -103,10 +121,10 @@ class LoggerConfigurationAdapterINITest
}
/**
- * Test a warning is triggered when configurator doesn't understand a line.
- * @ expectedException PHPUnit_Framework_Error
- * @ expectedExceptionMessage log4php: Don't know how to parse the following line: "log4php.appender.default.layout.param.bla = LoggerLayoutTTCC". Skipping.
- */
+ * Test a warning is triggered when configurator doesn't understand a line.
+ * @expectedException PHPUnit_Framework_Error
+ * @expectedExceptionMessage log4php: Don't know how to parse the following line: "log4php.appender.default.not-layout.param = LoggerLayoutTTCC". Skipping.
+ */
public function testInvalidLineWarning2() {
$url = dirname(__FILE__) . '/config4.ini';
$adapter = new LoggerConfigurationAdapterINI();
Modified: logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterPHPTest.php
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterPHPTest.php?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterPHPTest.php (original)
+++ logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterPHPTest.php Wed Sep 21 05:43:15 2011
@@ -1,6 +1,25 @@
<?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
+ */
+
+/**
* @group configurators
*/
class LoggerConfigurationAdapterPHPTest extends PHPUnit_Framework_TestCase {
Modified: logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterXMLTest.php
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterXMLTest.php?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterXMLTest.php (original)
+++ logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/LoggerConfigurationAdapterXMLTest.php Wed Sep 21 05:43:15 2011
@@ -1,6 +1,25 @@
<?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
+ */
+
+/**
* @group configurators
*/
class LoggerConfigurationAdapterXMLTest extends PHPUnit_Framework_TestCase {
Modified: logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/config2.ini
URL: http://svn.apache.org/viewvc/logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/config2.ini?rev=1173501&r1=1173500&r2=1173501&view=diff
==============================================================================
--- logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/config2.ini (original)
+++ logging/log4php/branches/experimental/config-adapters/src/test/php/configurators/config2.ini Wed Sep 21 05:43:15 2011
@@ -1,5 +1,2 @@
-#not valid because it doesn't have a line break at the end.
-log4php.rootLogger = DEBUG, default
-
-log4php.appender.default = LoggerAppenderEcho
-log4php.appender.default.layout = LoggerLayoutTTCC
\ No newline at end of file
+not a valid ini file ()
+