本文整理汇总了PHP中Logger::configure方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::configure方法的具体用法?PHP Logger::configure怎么用?PHP Logger::configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::configure方法的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: __construct
public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
parent::__construct($request, $response, $invokeArgs);
date_default_timezone_set(DATE_ZONE);
Logger::configure(LOG_ERROR);
$this->_logger = Logger::getLogger(__CLASS__);
}
示例4: __construct
function __construct($jsonPath)
{
include $this->loggerPath;
Logger::configure($this->loggerConfigPath);
$this->logger = Logger::getLogger("main");
$this->jsonFilePath = $jsonPath;
}
示例5: lib_log4php_load
/**
* Loads the log4php library.
*/
function lib_log4php_load()
{
require LIB_LOG4PHP_PATH . '/Logger.php';
// start logging
Logger::configure(LIB_LOG4PHP_CONFIGFILE_PATH);
$logger = Logger::getLogger('system.libs.log4php');
$logger->info('log4php started');
}
示例6: setup
public function setup()
{
// for compatibility / remove and enable only the plugins you want
$this->enableAllPluginsExcept(array());
// Set up logging - use different config for test environment
$logConfig = sfConfig::get('sf_environment') == 'test' ? 'log4php_test.properties' : 'log4php.properties';
Logger::configure(dirname(__FILE__) . '/' . $logConfig, 'OrangeHRMLogConfigurator');
}
示例7: __construct
public function __construct($logger = 'default')
{
$pathXML = LIB . DS . 'log' . DS . 'config.xml';
$configurator = new LoggerConfiguratorDefault();
$config = $configurator->parse($pathXML);
Logger::configure($config);
$this->logger = Logger::getLogger($logger);
}
示例8: configure
/**
* Configures log4php and the PHP error & exception handlers
* to log all errors and exceptions through log4php.
*
* @param string $log4phpConfiguration
* the log4php configuration filename
*/
public static final function configure($log4phpConfiguration)
{
\Logger::configure($log4phpConfiguration);
set_error_handler('\\PHPYAM\\libs\\LoggerUtils::errorHandler');
set_exception_handler('\\PHPYAM\\libs\\LoggerUtils::exceptionHandler');
// TODO: add register_shutdown_function() for non-catchable errors?
// http://phpfunk.com/php/capture-fatal-php-errors-for-logging/
}
示例9: __construct
public function __construct()
{
date_default_timezone_set(DATE_ZONE);
Logger::configure(LOG_ERROR);
$this->logger = Logger::getLogger(__CLASS__);
$this->logger->debug("Inicializando la base de datos.");
$this->initDB();
}
示例10: 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;
}
示例11: __construct
public final function __construct()
{
\Logger::configure("..\\config\\logger.xml");
$this->log = \Logger::getLogger(__CLASS__);
/** @var $this->Session Session */
$this->Session = \src\singleton\Session::inst();
$this->Session->Start();
$this->RenderPage();
}
示例12: __construct
/**
* 初始化Log4php
*/
public function __construct()
{
$config =& get_config();
if (is_numeric($config['log_threshold'])) {
$this->_threshold = $config['log_threshold'];
}
require_once LOG4PHP_PATH . 'Logger.php';
Logger::configure(APPPATH . 'config/log_dailyfile.xml');
}
示例13: 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();
}
示例14: init
public static function init()
{
if (self::$_initialized === TRUE) {
return;
}
Logger::configure(__DIR__ . '/../config/log4php/config.xml');
self::$_log = Logger::getLogger(__CLASS__);
self::$_initialized = TRUE;
}
示例15: __construct
private function __construct()
{
$this->logger = new NullLog4php();
$this->sqlLogger = new NullLog4php();
if (file_exists($f = ROOT_DIR . 'config/log4php.config.xml')) {
Logger::configure($f);
$this->logger = Logger::getLogger('default');
$this->sqlLogger = Logger::getLogger('sql');
}
}