/** * @see \Components\Log_Appender::initialize() initialize */ public function initialize() { if (false === $this->m_initialized) { parent::initialize(); \LoggerPropertyConfigurator::configure($this->getConfigurationFile()); $this->m_logger = $this->getLoggerImpl(\str\underscoreToCamelCase(__CLASS__)); $this->level = self::$m_mapNameToLevel[strtolower($this->m_logger->getEffectiveLevel())]; $this->m_initialized = true; } }
public function doConfigureProperties($properties, &$hierarchy) { // TODO: should search for file appenders instead define('FILE_APPENDER', 'log4php.appender.A1.file'); if (isset($properties[FILE_APPENDER])) { $logFilename = $properties[FILE_APPENDER]; $logFilename = str_replace('LOG_HOME', DIF_SYSTEM_ROOT . 'log', $logFilename); // make logfile available to everyone define('LOG_FILE', $logFilename); $properties[FILE_APPENDER] = $logFilename; } parent::doConfigureProperties($properties, $hierarchy); }
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. ********************************************************************************/ // This file should no longer be used in the main product. It is provided for backwards compatibility only. require_once 'config.php'; if (!defined('LOG4PHP_DIR')) { define('LOG4PHP_DIR', 'log4php'); } if (!defined('LOG4PHP_DEFAULT_INIT_OVERRIDE')) { define('LOG4PHP_DEFAULT_INIT_OVERRIDE', true); } require_once LOG4PHP_DIR . '/LoggerManager.php'; require_once LOG4PHP_DIR . '/LoggerPropertyConfigurator.php'; if (!isset($simple_log) || $simple_log == false) { $config = new LoggerPropertyConfigurator(); $config->configure('log4php.properties'); } class SimpleLog { var $fp; var $logfile = 'sugarcrm.log'; var $loglevel = 5; var $nolog = false; function SimpleLog() { global $loglevel, $logfile; if (!empty($loglevel)) { if ($loglevel == 'fatal') { $this->loglevel = 5; } else {
/** * Configure the default repository using the resource pointed by <b>url</b>. * <b>Url</b> is any valid resurce as defined in {@link PHP_MANUAL#file} function. * Note that the resource will be search with <i>use_include_path</i> parameter * set to "1". * * @param string $url * @return boolean configuration result * @static */ function configure($url = '') { $configurator = new LoggerPropertyConfigurator(); $repository =& LoggerManager::getLoggerRepository(); return $configurator->doConfigure($url, $repository); }
function __construct() { LoggerPropertyConfigurator::$singleton = $this; }
function setupLogging() { global $default; $oKTConfig =& KTConfig::getSingleton(); if (!defined('APP_NAME')) { define('APP_NAME', $oKTConfig->get('ui/appName', 'KnowledgeTree')); } define('KT_LOG4PHP_DIR', KT_DIR . '/thirdparty/apache-log4php/src/main/php' . DIRECTORY_SEPARATOR); define('LOG4PHP_CONFIGURATION', KT_DIR . '/config/ktlog.ini'); define('LOG4PHP_DEFAULT_INIT_OVERRIDE', true); require_once KT_LOG4PHP_DIR . 'LoggerManager.php'; require_once KT_LOG4PHP_DIR . 'LoggerPropertyConfigurator.php'; $configurator = new LoggerPropertyConfigurator(); $repository = LoggerManager::getLoggerRepository(); $properties = @parse_ini_file(LOG4PHP_CONFIGURATION); $properties['log4php.appender.default'] = 'LoggerAppenderDailyFile'; $properties['log4php.appender.default.layout'] = 'LoggerPatternLayout'; $properties['log4php.appender.default.layout.conversionPattern'] = '%d{Y-m-d | H:i:s} | %p | %t | %r | %X{userid} | %X{db} | %c | %M | %m%n'; $properties['log4php.appender.default.datePattern'] = 'Y-m-d'; $logDir = $oKTConfig->get('urls/logDirectory'); $properties['log4php.appender.default.file'] = $logDir . '/kt%s.' . KTUtil::running_user() . '.log.txt'; // get the log level set in the configuration settings to override the level set in ktlog.ini // for the default / main logging. Additional logging can be configured through the ini file $logLevel = $oKTConfig->get('KnowledgeTree/logLevel'); $properties['log4php.rootLogger'] = $logLevel . ', default'; session_start(); $configurator->doConfigureProperties($properties, $repository); $userId = isset($_SESSION['userID']) ? $_SESSION['userID'] : 'n/a'; LoggerMDC::put('userid', $userId); LoggerMDC::put('db', $oKTConfig->get('db/dbName')); $default->log = LoggerManager::getLogger('default'); $default->queryLog = LoggerManager::getLogger('sql'); $default->timerLog = LoggerManager::getLogger('timer'); $default->phpErrorLog = LoggerManager::getLogger('php'); }
static function getlogger($name = 'ROOT') { $configinfo = LoggerPropertyConfigurator::getInstance()->getConfigInfo($name); return new Logger($name, $configinfo); }
/********************************************************************************* * The contents of this file are subject to the SugarCRM Public License Version 1.1.2 * ("License"); You may not use this file except in compliance with the * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License. * The Original Code is: SugarCRM Open Source * The Initial Developer of the Original Code is SugarCRM, Inc. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.; * All Rights Reserved. * Contributor(s): ______________________________________. ********************************************************************************/ /********************************************************************************* * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/include/logging.php,v 1.1 2004/08/17 13:23:37 gjayakrishnan Exp $ * Description: Kicks off log4php. ********************************************************************************/ require_once 'config.php'; global $site_instance_dir; global $is_instances; define('LOG4PHP_DIR', 'log4php'); define('LOG4PHP_DEFAULT_INIT_OVERRIDE', true); require_once LOG4PHP_DIR . '/LoggerManager.php'; require_once LOG4PHP_DIR . '/LoggerPropertyConfigurator.php'; $config = new LoggerPropertyConfigurator(); if ($is_instances) { $config->configure($site_instance_dir . '/log4php.properties'); } else { $config->configure('log4php.properties'); }