本文整理汇总了PHP中LoggerManager::getRootLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP LoggerManager::getRootLogger方法的具体用法?PHP LoggerManager::getRootLogger怎么用?PHP LoggerManager::getRootLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoggerManager
的用法示例。
在下文中一共展示了LoggerManager::getRootLogger方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
/**
* Add a {@link LoggerAppenderConsole} that uses
* the {@link LoggerLayoutTTCC} to the root category.
*
* @param string $url not used here
*/
public static function configure($url = null)
{
$root = LoggerManager::getRootLogger();
$appender = new LoggerAppenderConsole('A1');
$appender->setLayout(new LoggerLayoutTTCC());
$root->addAppender($appender);
}
示例2: configure
/**
* Add a {@link LoggerAppenderConsole} that uses
* the {@link LoggerLayoutTTCC} to the root category.
*
* @param string $url not used here
* @static
*/
function configure($url = null)
{
$root =& LoggerManager::getRootLogger();
$appender =& LoggerAppender::singleton('A1', 'LoggerAppenderConsole');
$layout = LoggerLayout::factory('LoggerLayoutTTCC');
$appender->setLayout($layout);
$root->addAppender($appender);
}
示例3: getRootLogger
/**
* get the Root Logger (Delegate to {@link LoggerManager})
* @return LoggerRoot
* @static
*/
public function getRootLogger()
{
return LoggerManager::getRootLogger();
}
示例4:
/**
* Return the root of the default category hierrachy.
* @return LoggerRoot
*/
function &getRoot()
{
return LoggerManager::getRootLogger();
}
示例5: define
<?php
/**
*
* Author: Khurram Ijaz (khurram@renai-soft.com)
* Company: Renaissance Software / Intellicomdevelopment.com (info@renai-soft.com)
* All rights reserved.
*
*
*
*/
define('LOG4PHP_CONFIGURATION', $cfg['config_dir'] . '/log4php.properties');
$_ENV['LOGFILEPATH'] = $cfg['log_dir'] . '/log.txt';
require_once 'libs/log4php/LoggerManager.php';
$log =& LoggerManager::getRootLogger();
if (!$log) {
echo 'no log';
exit;
}
$log->info("Logging configured successfully.");
示例6: tagOpen
//.........这里部分代码省略.........
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LOGGER. " . "class '{$className}' doesnt implement 'getLogger()' method.");
}
}
}
if ($this->logger !== null and isset($attribs['ADDITIVITY'])) {
$additivity = LoggerOptionConverter::toBoolean($this->subst($attribs['ADDITIVITY']), true);
$this->logger->setAdditivity($additivity);
}
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LOGGER. Attribute 'name' is not set or is empty.");
}
$this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE;
break;
case 'LEVEL':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':LEVEL':
case 'PRIORITY':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':PRIORITY':
if (!isset($attribs['VALUE'])) {
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL value not set");
break;
}
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL value={$attribs['VALUE']}");
if ($this->logger === null) {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LEVEL. parent logger is null");
break;
}
switch (end($this->state)) {
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE:
$this->logger->setLevel(LoggerOptionConverter::toLevel($this->subst($attribs['VALUE']), $this->logger->getLevel()));
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LEVEL root level is now '{$attribs['VALUE']}' ");
break;
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE:
$this->logger->setLevel(LoggerOptionConverter::toLevel($this->subst($attribs['VALUE']), $this->logger->getLevel()));
break;
default:
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LEVEL state '{$this->state}' not allowed here");
}
break;
case 'PARAM':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':PARAM':
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() PARAM");
if (!isset($attribs['NAME'])) {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM. " . "attribute 'name' not defined.");
break;
}
if (!isset($attribs['VALUE'])) {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM. " . "attribute 'value' not defined.");
break;
}
switch (end($this->state)) {
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_APPENDER_STATE:
if ($this->appender !== null) {
$this->setter($this->appender, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM. " . " trying to set property to a null appender.");
}
break;
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LAYOUT_STATE:
if ($this->layout !== null) {
$this->setter($this->layout, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM. " . " trying to set property to a null layout.");
}
break;
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_FILTER_STATE:
if ($this->filter !== null) {
$this->setter($this->filter, $this->subst($attribs['NAME']), $this->subst($attribs['VALUE']));
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM. " . " trying to set property to a null filter.");
}
break;
default:
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() PARAM state '{$this->state}' not allowed here");
}
break;
case 'RENDERER':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':RENDERER':
$renderedClass = $this->subst(@$attribs['RENDEREDCLASS']);
$renderingClass = $this->subst(@$attribs['RENDERINGCLASS']);
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() RENDERER renderedClass='{$renderedClass}' renderingClass='{$renderingClass}'");
if (!empty($renderedClass) and !empty($renderingClass)) {
$renderer = LoggerObjectRenderer::factory($renderingClass);
if ($renderer === null) {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() RENDERER cannot instantiate '{$renderingClass}'");
} else {
$this->repository->setRenderer($renderedClass, $renderer);
}
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() RENDERER renderedClass or renderingClass is empty");
}
break;
case 'ROOT':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':ROOT':
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() ROOT");
$this->logger =& LoggerManager::getRootLogger();
$this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE;
break;
}
}