本文整理汇总了PHP中Logger::resetConfiguration方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::resetConfiguration方法的具体用法?PHP Logger::resetConfiguration怎么用?PHP Logger::resetConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::resetConfiguration方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
Logger::resetConfiguration();
if (file_exists($this->testPath)) {
unlink($this->testPath);
}
}
示例2: testUsage
public function testUsage()
{
Logger::resetConfiguration();
Logger::configure(dirname(__FILE__) . '/test4.properties');
Logger::initialize();
$logger = Logger::getRootLogger();
ob_start();
$logger->error(new Fruit3());
$v = ob_get_contents();
ob_end_clean();
self::assertEquals("ERROR - test1,test2,test3\n", $v);
}
示例3: testUsage
public function testUsage()
{
Logger::resetConfiguration();
Logger::configure(dirname(__FILE__) . '/test4.properties');
$logger = Logger::getRootLogger();
ob_start();
$logger->warn(new Fruit3());
$actual = ob_get_contents();
ob_end_clean();
$expected = "WARN - test1,test2,test3" . PHP_EOL;
self::assertEquals($expected, $actual);
}
示例4: testComplexLayout
public function testComplexLayout()
{
$config = LoggerTestHelper::getEchoPatternConfig($this->pattern);
Logger::configure($config);
ob_start();
$log = Logger::getLogger('LoggerTest');
$log->error("my message");
$line = __LINE__;
$actual = ob_get_contents();
ob_end_clean();
$file = __FILE__;
$class = __CLASS__;
$method = __FUNCTION__;
$expected = "ERROR LoggerTest: my message from {$class}::{$method}() in {$file} at {$line}" . PHP_EOL;
self::assertSame($expected, $actual);
Logger::resetConfiguration();
}
示例5: testResetConfiguration
public function testResetConfiguration()
{
$root = Logger::getRootLogger();
$appender = $root->getAppender('A1');
self::assertType('LoggerAppenderConsole', $appender);
$layout = $appender->getLayout();
self::assertType('LoggerLayoutTTCC', $layout);
// As PHPUnit runs all tests in one run, there might be some loggers left over
// from previous runs. ResetConfiguration() only clears the appenders, it does
// not remove the categories!
Logger::resetConfiguration();
foreach (Logger::getCurrentLoggers() as $logger) {
self::assertEquals(0, count($logger->getAllAppenders()));
}
// This on the other hand really removes the categories:
Logger::clear();
self::assertEquals(0, count(Logger::getCurrentLoggers()));
}
示例6: tearDown
protected function tearDown()
{
Logger::resetConfiguration();
}
示例7: tearDown
/** Reset configuration after each test. */
public function tearDown()
{
Logger::resetConfiguration();
}
示例8: testLocation2
public function testLocation2()
{
$config = LoggerTestHelper::getEchoPatternConfig("%location");
Logger::configure($config);
// Test by capturing output. Logging methods of a Logger object must
// be used for the location info to be formed correctly.
ob_start();
$log = Logger::getLogger('foo');
$log->info('foo');
$line = __LINE__;
// Do NOT move this to next line.
$actual = ob_get_contents();
ob_end_clean();
$class = __CLASS__;
$func = __FUNCTION__;
$file = __FILE__;
$expected = "{$class}.{$func}({$file}:{$line})";
self::assertSame($expected, $actual);
Logger::resetConfiguration();
}
示例9: testGetCurrentLoggers
public function testGetCurrentLoggers()
{
Logger::clear();
Logger::resetConfiguration();
self::assertEquals(0, count(Logger::getCurrentLoggers()));
Logger::configure($this->testConfig1);
self::assertEquals(1, count(Logger::getCurrentLoggers()));
$list = Logger::getCurrentLoggers();
self::assertEquals('mylogger', $list[0]->getName());
}
示例10: testConfigure
public function testConfigure()
{
Logger::resetConfiguration();
Logger::configure();
self::assertEquals('LoggerConfiguratorBasic', Logger::getConfigurationClass());
self::assertEquals(null, Logger::getConfigurationFile());
Logger::configure(null, 'MyLoggerClass');
self::assertEquals('MyLoggerClass', Logger::getConfigurationClass());
self::assertEquals(null, Logger::getConfigurationFile());
Logger::configure('log4php.xml');
self::assertEquals('LoggerConfiguratorXml', Logger::getConfigurationClass());
self::assertEquals('log4php.xml', Logger::getConfigurationFile());
Logger::configure('log4php.xml');
self::assertEquals('LoggerConfiguratorXml', Logger::getConfigurationClass());
self::assertEquals('log4php.xml', Logger::getConfigurationFile());
Logger::configure('log4php.properties');
self::assertEquals('LoggerConfiguratorIni', Logger::getConfigurationClass());
self::assertEquals('log4php.properties', Logger::getConfigurationFile());
}
示例11: resetConfiguration
public static function resetConfiguration()
{
parent::resetConfiguration();
self::$_isInitialized = false;
}
示例12: testGetCurrentLoggers
public function testGetCurrentLoggers()
{
Logger::clear();
Logger::resetConfiguration();
self::assertEquals(0, count(Logger::getCurrentLoggers()));
Logger::configure(dirname(__FILE__) . '/LoggerTest.properties');
self::assertEquals(1, count(Logger::getCurrentLoggers()));
$list = Logger::getCurrentLoggers();
self::assertEquals('mylogger', $list[0]->getName());
}
示例13: testXMLConfig
public function testXMLConfig()
{
$map = Logger::getHierarchy()->getRendererMap();
Logger::resetConfiguration();
self::assertInstanceOf('LoggerRendererDefault', $map->getDefaultRenderer());
Logger::configure(PHPUNIT_CONFIG_DIR . '/renderers/config_default_renderer.xml');
self::assertInstanceOf('FruitRenderer3', $map->getDefaultRenderer());
Logger::resetConfiguration();
self::assertInstanceOf('LoggerRendererDefault', $map->getDefaultRenderer());
}