本文整理汇总了PHP中LoggerAppender类的典型用法代码示例。如果您正苦于以下问题:PHP LoggerAppender类的具体用法?PHP LoggerAppender怎么用?PHP LoggerAppender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LoggerAppender类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Adds an appender to the pool.
* The appender must be named for this operation.
* @param LoggerAppender $appender
*/
public static function add(LoggerAppender $appender)
{
$name = $appender->getName();
if (empty($name)) {
trigger_error('log4php: Cannot add unnamed appender to pool.', E_USER_WARNING);
return;
}
if (isset(self::$appenders[$name])) {
trigger_error("log4php: Appender [{$name}] already exists in pool. Overwriting existing appender.", E_USER_WARNING);
}
self::$appenders[$name] = $appender;
}
开发者ID:unkerror,项目名称:Budabot,代码行数:17,代码来源:LoggerAppenderPool.php
示例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);
}
开发者ID:roni5,项目名称:sela,代码行数:15,代码来源:LoggerBasicConfigurator.php
示例3: singleton
/**
* Singleton
*
* @param string $name appender name
* @param string $class create or get a reference instance of this class
* @return LoggerAppender
*/
function singleton($name, $class = '')
{
static $instances;
if (!empty($name)) {
if (!isset($instances[$name])) {
if (!empty($class)) {
$appender = LoggerAppender::factory($name, $class);
if ($appender !== null) {
$instances[$name] = $appender;
return $instances[$name];
}
}
return null;
}
return $instances[$name];
}
return null;
}
开发者ID:miztaka,项目名称:teeple2,代码行数:25,代码来源:LoggerAppender.php
示例4: isAttached
/**
* Checks whether an appender is attached to this logger instance.
*
* @param LoggerAppender $appender
* @return boolean
*/
public function isAttached(LoggerAppender $appender)
{
return isset($this->appenders[$appender->getName()]);
}
开发者ID:Lyonard,项目名称:PHPExperiments,代码行数:10,代码来源:Logger.php
示例5: isAttached
/**
* Is the appender passed as parameter attached to this category?
*
* @param LoggerAppender $appender
*/
public function isAttached($appender)
{
return isset($this->aai[$appender->getName()]);
}
开发者ID:laiello,项目名称:lion-framework,代码行数:9,代码来源:Logger.php
示例6: isAttached
/**
* Is the appender passed as parameter attached to this category?
*
* @param LoggerAppender $appender
*/
function isAttached($appender)
{
return in_array($appender->getName(), array_keys($this->aai));
}
开发者ID:Bobsel,项目名称:gn-tic,代码行数:9,代码来源:LoggerCategory.php
示例7: createAppenderFilter
/**
* Parses filter config, creates the filter and adds it to the appender's
* filter chain.
* @param LoggerAppender $appender
* @param array $config Filter configuration.
*/
private function createAppenderFilter(LoggerAppender $appender, $config)
{
$name = $appender->getName();
$class = $config['class'];
if (!class_exists($class)) {
$this->warn("Nonexistant filter class [{$class}] specified on appender [{$name}]. Skipping filter definition.");
return;
}
$filter = new $class();
if (!$filter instanceof LoggerFilter) {
$this->warn("Invalid filter class [{$class}] sepcified on appender [{$name}]. Skipping filter definition.");
return;
}
if (isset($config['params'])) {
$this->setOptions($filter, $config['params']);
}
$filter->activateOptions();
$appender->addFilter($filter);
}
开发者ID:NetworkCedu,项目名称:saigon,代码行数:25,代码来源:LoggerConfiguratorDefault.php
示例8: tagOpen
/**
* @param mixed $parser
* @param string $tag
* @param array $attribs
*
* @todo In 'LOGGER' case find a better way to detect 'getLogger()' method
*/
function tagOpen($parser, $tag, $attribs)
{
switch ($tag) {
case 'CONFIGURATION':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':CONFIGURATION':
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() CONFIGURATION");
if (isset($attribs['THRESHOLD'])) {
$this->repository->setThreshold(LoggerOptionConverter::toLevel($this->subst($attribs['THRESHOLD']), $this->repository->getThreshold()));
}
if (isset($attribs['DEBUG'])) {
$debug = LoggerOptionConverter::toBoolean($this->subst($attribs['DEBUG']), LoggerLog::internalDebugging());
$this->repository->debug = $debug;
LoggerLog::internalDebugging($debug);
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LOG4PHP:CONFIGURATION. Internal Debug turned " . ($debug ? 'on' : 'off'));
}
break;
case 'APPENDER':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':APPENDER':
unset($this->appender);
$this->appender = null;
$name = $this->subst(@$attribs['NAME']);
$class = $this->subst(@$attribs['CLASS']);
LoggerLog::debug("LoggerDOMConfigurator::tagOpen():tag=[{$tag}]:name=[{$name}]:class=[{$class}]");
$this->appender =& LoggerAppender::singleton($name, $class);
if ($this->appender === null) {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER cannot instantiate appender '{$name}'");
}
$this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_APPENDER_STATE;
break;
case 'APPENDER_REF':
case 'APPENDER-REF':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':APPENDER_REF':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':APPENDER-REF':
if (isset($attribs['REF']) and !empty($attribs['REF'])) {
$appenderName = $this->subst($attribs['REF']);
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref='{$appenderName}'");
$appender =& LoggerAppender::singleton($appenderName);
if ($appender !== null) {
switch (end($this->state)) {
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_LOGGER_STATE:
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_ROOT_STATE:
$this->logger->addAppender($appender);
break;
}
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref '{$appenderName}' points to a null appender");
}
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() APPENDER-REF ref not set or empty");
}
break;
case 'FILTER':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':FILTER':
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() FILTER");
unset($this->filter);
$this->filter = null;
$filterName = basename($this->subst(@$attribs['CLASS']));
if (!empty($filterName)) {
if (!class_exists($filterName)) {
@(include_once LOG4PHP_DIR . "/varia/{$filterName}.php");
}
if (class_exists($filterName)) {
$this->filter = new $filterName();
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() FILTER. class '{$filterName}' doesnt exist");
}
$this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_FILTER_STATE;
} else {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() FILTER filter name cannot be empty");
}
break;
case 'LAYOUT':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':LAYOUT':
$class = @$attribs['CLASS'];
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LAYOUT class='{$class}'");
$this->layout = LoggerLayout::factory($this->subst($class));
if ($this->layout === null) {
LoggerLog::warn("LoggerDOMConfigurator::tagOpen() LAYOUT unable to instanciate class='{$class}'");
}
$this->state[] = LOG4PHP_LOGGER_DOM_CONFIGURATOR_LAYOUT_STATE;
break;
case 'LOGGER':
case LOG4PHP_LOGGER_DOM_CONFIGURATOR_XMLNS . ':LOGGER':
// $this->logger is assigned by reference.
// Only '$this->logger=null;' destroys referenced object
unset($this->logger);
$this->logger = null;
$loggerName = $this->subst(@$attribs['NAME']);
if (!empty($loggerName)) {
LoggerLog::debug("LoggerDOMConfigurator::tagOpen() LOGGER. name='{$loggerName}'");
$class = $this->subst(@$attribs['CLASS']);
if (empty($class)) {
$this->logger =& $this->repository->getLogger($loggerName);
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:101,代码来源:LoggerDOMConfigurator.php
示例9:
/**
* @param array $props array of properties
* @param string $appenderName
* @return LoggerAppender
*/
function &parseAppender($props, $appenderName)
{
$appender =& LoggerAppender::singleton($appenderName);
if ($appender !== null) {
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "Appender [{$appenderName}] was already parsed.");
return $appender;
}
// Appender was not previously initialized.
$prefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_APPENDER_PREFIX . $appenderName;
$layoutPrefix = $prefix . ".layout";
$appenderClass = @$props[$prefix];
if (!empty($appenderClass)) {
$appender =& LoggerAppender::singleton($appenderName, $appenderClass);
if ($appender === null) {
LoggerLog::warn("LoggerPropertyConfigurator::parseAppender() " . "Could not instantiate appender named [{$appenderName}].");
return null;
}
} else {
LoggerLog::warn("LoggerPropertyConfigurator::parseAppender() " . "Could not instantiate appender named [{$appenderName}] with null className.");
return null;
}
$appender->setName($appenderName);
if ($appender->requiresLayout()) {
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "Parsing layout section for [{$appenderName}].");
$layoutClass = @$props[$layoutPrefix];
$layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
if (empty($layoutClass)) {
LoggerLog::warn("LoggerPropertyConfigurator::parseAppender() " . "layout class is empty in '{$layoutPrefix}'. Using Simple layout");
$layout = LoggerLayout::factory('LoggerLayoutSimple');
} else {
$layout = LoggerLayout::factory($layoutClass);
if ($layout === null) {
LoggerLog::warn("LoggerPropertyConfigurator::parseAppender() " . "cannot create layout '{$layoutClass}'. Using Simple layout");
$layout = LoggerLayout::factory('LoggerLayoutSimple');
}
}
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "Parsing layout options for [{$appenderName}].");
LoggerPropertySetter::setPropertiesByObject($layout, $props, $layoutPrefix . ".");
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "End Parsing layout options for [{$appenderName}].");
$appender->setLayout($layout);
}
LoggerPropertySetter::setPropertiesByObject($appender, $props, $prefix . ".");
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "Parsed [{$appenderName}] options.");
return $appender;
}
开发者ID:ruckfull,项目名称:taobaocrm,代码行数:50,代码来源:LoggerPropertyConfigurator.php
示例10: __construct
public function __construct($name = '')
{
parent::__construct($name);
$this->logBuffer = array();
$this->logLimit = 50;
$this->emitter = new Evenement\EventEmitter();
}
开发者ID:unkerror,项目名称:Budabot,代码行数:7,代码来源:LoggerAppenderBuffer.php
示例11: __construct
public function __construct($name = '')
{
parent::__construct($name);
$this->host = self::DEFAULT_MONGO_URL_PREFIX . self::DEFAULT_MONGO_HOST;
$this->port = self::DEFAULT_MONGO_PORT;
$this->databaseName = self::DEFAULT_DB_NAME;
$this->collectionName = self::DEFAULT_COLLECTION_NAME;
}
开发者ID:RobertWang,项目名称:sabre-zarafa,代码行数:8,代码来源:LoggerAppenderMongoDB.php
示例12: __construct
/**
* Constructor.
*
* @param string $name appender name
*/
public function __construct($name = '')
{
parent::__construct($name);
}
开发者ID:haitao1880,项目名称:study,代码行数:9,代码来源:LoggerAppenderMail.php
示例13: reset
public function reset()
{
$this->close();
parent::reset();
}
开发者ID:sacredwebsite,项目名称:scalr,代码行数:5,代码来源:LoggerAppenderSocket.php
示例14:
/**
* Constructor.
*
* @param string $name appender name
*/
function __construct($name)
{
parent::__construct($name);
}
开发者ID:munishsethi777,项目名称:eliveui,代码行数:9,代码来源:LoggerAppenderAdodb.php
示例15: __construct
/**
* Constructor.
* This apender doesn't require a layout.
* @param string $name appender name
*/
public function __construct($name = '')
{
parent::__construct($name);
$this->requiresLayout = false;
}
开发者ID:BGCX067,项目名称:ezboss-svn-to-git,代码行数:10,代码来源:LoggerAppenderPDO.php
示例16: __construct
public function __construct($name = '')
{
parent::__construct($name);
$this->firstAppend = true;
}
开发者ID:haitao1880,项目名称:study,代码行数:5,代码来源:LoggerAppenderEcho.php
示例17: __construct
public function __construct($name = '')
{
parent::__construct($name);
$this->host = self::DEFAULT_MONGO_URL_PREFIX . self::DEFAULT_MONGO_HOST;
$this->port = self::DEFAULT_MONGO_PORT;
$this->databaseName = self::DEFAULT_DB_NAME;
$this->collectionName = self::DEFAULT_COLLECTION_NAME;
$this->timeout = self::DEFAULT_TIMEOUT_VALUE;
$this->requiresLayout = false;
}
开发者ID:brennantom,项目名称:hackazon,代码行数:10,代码来源:LoggerAppenderMongoDB.php
示例18: close
public function close()
{
if ($this->getFlushOnShutdown()) {
$this->sendLogsArrayToAMQP($this->logsStash);
$this->cleanStashedLogs();
}
$this->setAMQPExchange(null);
$this->setAMQPConnection(null);
parent::close();
}
开发者ID:wikimart,项目名称:log4php-graylog2,代码行数:10,代码来源:LoggerAppenderAMQP.php
注:本文中的LoggerAppender类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论