本文整理汇总了PHP中Logger::getRootLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::getRootLogger方法的具体用法?PHP Logger::getRootLogger怎么用?PHP Logger::getRootLogger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::getRootLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testThreshold
public function testThreshold()
{
Logger::configure('configurators/test1.xml');
$root = Logger::getRootLogger();
self::assertEquals(LoggerLevel::getLevelWarn(), $root->getLevel());
$appender = $root->getAppender("default");
self::assertTrue($appender instanceof LoggerAppenderEcho);
$layout = $appender->getLayout();
self::assertTrue($layout instanceof LoggerLayoutSimple);
$threshold = $appender->getThreshold();
self::assertTrue($threshold instanceof LoggerLevel);
$e = LoggerLevel::getLevelWarn();
self::assertEquals($e, $threshold);
$appender = $root->getAppender("blub");
self::assertTrue($appender instanceof LoggerAppenderEcho);
$layout = $appender->getLayout();
self::assertTrue($layout instanceof LoggerLayoutSimple);
$threshold = $appender->getThreshold();
self::assertTrue($threshold instanceof LoggerLevel);
$e = LoggerLevel::getLevelInfo();
self::assertEquals($e, $threshold);
$filter = $appender->getFilter();
self::assertTrue($filter instanceof LoggerFilterLevelRange);
$filter2 = $filter->getNext();
self::assertTrue($filter2 instanceof LoggerFilterDenyAll);
$threshold = Logger::getHierarchy()->getThreshold();
self::assertTrue($threshold instanceof LoggerLevel);
$e = LoggerLevel::getLevelWarn();
self::assertEquals($e, $threshold);
$hierarchy = Logger::getHierarchy();
$map = $hierarchy->getRendererMap();
$clazz = $map->getByClassName('Fruit2');
self::assertTrue($clazz instanceof FruitRenderer2);
}
示例2: get_logger
function get_logger()
{
require_once EZBOSS_THIRDPARTY_PATH . '/Apache/log4php/Logger.php';
Logger::configure(EZBOSS_WEBROOT . '/config/appender_dailyfile.properties');
$logger = Logger::getRootLogger();
return $logger;
}
示例3: getBufferAppender
public static function getBufferAppender()
{
$appender = \Logger::getRootLogger()->getAppender('appenderBuffer');
if (!$appender) {
$appender = new LoggerAppenderBuffer();
}
return $appender;
}
示例4: __construct
public function __construct()
{
session_start();
ob_start("ob_gzhandler");
date_default_timezone_set("UTC");
$this->logger = Logger::getRootLogger();
$this->logger->debug("Controller Constructor function");
$this->data["request"] = $_REQUEST;
}
示例5: getLogger
protected function getLogger()
{
if (null == $this->_logger) {
$logfile = self::$_logname . "log.xml";
Logger::configure(CONF_PATH . DIRECTORY_SEPARATOR . $logfile);
$this->_logger = Logger::getRootLogger();
}
return $this->_logger;
}
示例6: initialize_logger
function initialize_logger($name)
{
if (!IN_DEBUG) {
return;
}
global $logger;
Logger::configure(array('rootLogger' => array('appenders' => array('default')), 'appenders' => array('default' => array('class' => 'LoggerAppenderRollingFile', 'layout' => array('class' => 'LoggerLayoutPattern', "params" => array("ConversionPattern" => "%d{ISO8601} [%p] %m (at %F line %L)%n")), 'params' => array('file' => join_paths(QWP_LOG_DIR, $name . '.log'), 'append' => true, 'MaxFileSize' => '10MB', 'MaxBackupIndex' => '3')))));
$logger = Logger::getRootLogger();
}
示例7: testAppendStderr
public function testAppendStderr()
{
$this->config['appenders']['default']['params']['target'] = 'stderr';
Logger::configure($this->config);
$log = Logger::getRootLogger();
$expected = LoggerAppenderConsole::STDERR;
$actual = $log->getAppender('default')->getTarget();
$this->assertSame($expected, $actual);
$log->info("hello");
}
示例8: _initLogger
public function _initLogger()
{
require_once APPLICATION_PATH . "/application/library/Log/Logger.php";
Logger::configure(APPLICATION_PATH . "/conf/logconf.php");
$logger = Logger::getRootLogger();
Yaf_Registry::set('logger', $logger);
// Logger::configure(APPLICATION_PATH . "/conf/statlogconf.php");
// $statLogger = Logger::getRootLogger();
// Yaf_Registry::set('statLogger', $statLogger);
}
示例9: testIsEnabledFor
public function testIsEnabledFor()
{
Logger::configure('LoggerTest.properties');
$logger = Logger::getLogger('mylogger');
self::assertTrue($logger->isDebugEnabled());
self::assertTrue($logger->isInfoEnabled());
$logger = Logger::getRootLogger();
self::assertFalse($logger->isDebugEnabled());
self::assertFalse($logger->isInfoEnabled());
}
示例10: testConfigureWithRootCategory
public function testConfigureWithRootCategory()
{
Logger::configure('configurators/test3.properties');
$root = Logger::getRootLogger();
self::assertEquals(LoggerLevel::getLevelWarn(), $root->getLevel());
$appender = $root->getAppender("default");
self::assertTrue($appender instanceof LoggerAppenderEcho);
$layout = $appender->getLayout();
self::assertTrue($layout instanceof LoggerLayoutSimple);
}
示例11: testConfigure
public function testConfigure()
{
Logger::configure('configurators/test1.php', 'LoggerConfiguratorPhp');
$root = Logger::getRootLogger();
self::assertEquals(LoggerLevel::getLevelWarn(), $root->getLevel());
$appender = $root->getAppender("default");
self::assertTrue($appender instanceof LoggerAppenderEcho);
$layout = $appender->getLayout();
self::assertTrue($layout instanceof LoggerLayoutSimple);
$logger = Logger::getLogger('mylogger');
self::assertEquals(LoggerLevel::getLevelInfo(), $logger->getLevel());
}
示例12: 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);
}
示例13: 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);
}
示例14: testHtmlLineBreaks
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);
}
示例15: sendSMS
private function sendSMS($http, $uid, $pwd, $mobile, $content, $mobileids, $time = '', $mid = '')
{
$data = array('uid' => $uid, 'pwd' => md5($pwd . $uid), 'mobile' => $mobile, 'content' => $content, 'mobileids' => $mobileids, 'time' => $time);
$re = $this->postSMS($http, $data);
//POST方式提交
//if( trim($re) == '100' )
if (trim($re) == 'sms&stat=100&message=发送成功') {
Logger::getRootLogger()->debug("Sms:发送成功");
return 0;
} else {
Logger::getRootLogger()->debug("发送失败! 状态:" . $re);
return 1;
}
}