本文整理汇总了PHP中Propel::setLogger方法的典型用法代码示例。如果您正苦于以下问题:PHP Propel::setLogger方法的具体用法?PHP Propel::setLogger怎么用?PHP Propel::setLogger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Propel
的用法示例。
在下文中一共展示了Propel::setLogger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* @see sfPluginConfiguration
*/
public function initialize()
{
sfConfig::set('sf_orm', 'propel');
if (!sfConfig::get('sf_admin_module_web_dir')) {
sfConfig::set('sf_admin_module_web_dir', '/sfPropelPlugin');
}
sfToolkit::addIncludePath(array(sfConfig::get('sf_root_dir'), sfConfig::get('sf_propel_runtime_path', realpath(dirname(__FILE__) . '/../lib/vendor'))));
require_once 'propel/Propel.php';
if (!Propel::isInit()) {
if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
Propel::setLogger(new sfPropelLogger($this->dispatcher));
}
$propelConfiguration = new PropelConfiguration();
Propel::setConfiguration($propelConfiguration);
$this->dispatcher->notify(new sfEvent($propelConfiguration, 'propel.configure'));
Propel::initialize();
}
$this->dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
if (sfConfig::get('sf_web_debug')) {
$this->dispatcher->connect('debug.web.load_panels', array('sfWebDebugPanelPropel', 'listenToAddPanelEvent'));
}
if (sfConfig::get('sf_test')) {
$this->dispatcher->connect('context.load_factories', array($this, 'clearAllInstancePools'));
}
}
示例2: __construct
public function __construct()
{
$this->wwwPath = Curry_Core::$config->curry->wwwPath;
Propel::disableInstancePooling();
Propel::setLogger(null);
if ($this->debug) {
$this->con = Propel::getConnection(PagePeer::DATABASE_NAME);
$this->con->useDebug(true);
}
$this->setupLogger();
}
示例3: initialize
/**
* Initialize this data source.
*
* @param AgaviContext The current application context.
* @param array An associative array of initialization parameters.
*
* @throws <b>AgaviInitializationException</b> If an error occurs while
* initializing.
*
*/
public function initialize(AgaviContext $context, array $parameters = array())
{
parent::initialize($context, $parameters);
$pdo = $this->context->getDatabaseConnection($this->getParameter('database_name'));
if ($pdo instanceof DebugPDO) {
$pdo->setLogger($this);
} else {
$this->log('NOTICE: The PDO connection might not support query logging. Refer to Propel documentation on how to enable full query logging.');
}
Propel::setLogger($this);
}
示例4: initialize
public static function initialize()
{
$dbConfigs = array();
$pluginInstances = KalturaPluginManager::getPluginInstances('IKalturaDatabaseConfig');
foreach ($pluginInstances as $pluginInstance) {
$dbConfigs[] = $pluginInstance->getDatabaseConfig();
}
foreach ($dbConfigs as $dbConfig) {
self::addExtraConfiguration($dbConfig);
}
Propel::setConfiguration(self::$config);
Propel::setLogger(KalturaLog::getInstance());
Propel::initialize();
}
示例5: initialize
public static function initialize()
{
$dbConfigs = self::getExtraDatabaseConfigs();
foreach ($dbConfigs as $dbConfig) {
self::addExtraConfiguration($dbConfig);
}
Propel::setConfiguration(self::$config);
Propel::setLogger(KalturaLog::getInstance());
try {
Propel::initialize();
} catch (PropelException $pex) {
KalturaLog::alert($pex->getMessage());
throw new PropelException("Database error");
}
}
示例6: boot
/**
* {@inheritdoc}
*/
public function boot()
{
require_once $this->container->getParameter('propel.path') . '/runtime/lib/Propel.php';
if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) {
set_include_path($this->container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path());
}
if (!\Propel::isInit()) {
\Propel::setConfiguration($this->container->get('propel.configuration'));
if ($this->container->getParameter('propel.logging')) {
$this->container->get('propel.configuration')->setParameter('debugpdo.logging.details', array('time' => array('enabled' => true), 'mem' => array('enabled' => true)));
\Propel::setLogger($this->container->get('propel.logger'));
}
\Propel::initialize();
}
}
示例7: boot
/**
* {@inheritdoc}
*/
public function boot()
{
require_once $this->container->getParameter('propel.path') . '/runtime/lib/Propel.php';
if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) {
set_include_path($this->container->getParameter('kernel.root_dir') . '/..' . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path());
}
if (!\Propel::isInit()) {
\Propel::setConfiguration($this->container->get('propel.configuration'));
if ($this->container->getParameter('propel.logging')) {
$config = $this->container->get('propel.configuration');
$config->setParameter('debugpdo.logging.methods', array('PropelPDO::exec', 'PropelPDO::query', 'PropelPDO::prepare', 'DebugPDOStatement::execute'), false);
$config->setParameter('debugpdo.logging.details', array('time' => array('enabled' => true), 'mem' => array('enabled' => true), 'connection' => array('enabled' => true)));
\Propel::setLogger($this->container->get('propel.logger'));
}
\Propel::initialize();
}
}
示例8: __construct
/**
* Constructor.
*/
public function __construct()
{
parent::__construct();
// Override and increase max execution time if set
$timeLimit = ini_get('max_execution_time');
if ($timeLimit && $timeLimit < 250) {
@set_time_limit(250);
}
Propel::disableInstancePooling();
Propel::setLogger(null);
// make sure all classes are included
foreach (Curry_Propel::getModels() as $classes) {
foreach ($classes as $clazz) {
class_exists($clazz . 'Peer', true);
}
}
}
示例9: boot
/**
* {@inheritdoc}
*/
public function boot()
{
trigger_error("The PropelBundle uses a new branching model, you should switch to the 1.1 branch (1.1.x versions). For more information, please read: https://github.com/propelorm/PropelBundle/wiki", E_USER_DEPRECATED);
require_once $this->container->getParameter('propel.path') . '/runtime/lib/Propel.php';
if (0 === strncasecmp(PHP_SAPI, 'cli', 3)) {
set_include_path($this->container->getParameter('kernel.root_dir') . '/..' . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . PATH_SEPARATOR . $this->container->getParameter('propel.phing_path') . '/classes' . PATH_SEPARATOR . get_include_path());
}
if (!\Propel::isInit()) {
\Propel::setConfiguration($this->container->get('propel.configuration'));
if ($this->container->getParameter('propel.logging')) {
$config = $this->container->get('propel.configuration');
$config->setParameter('debugpdo.logging.methods', array('PropelPDO::exec', 'PropelPDO::query', 'PropelPDO::prepare', 'DebugPDOStatement::execute'), false);
$config->setParameter('debugpdo.logging.details', array('time' => array('enabled' => true), 'mem' => array('enabled' => true), 'connection' => array('enabled' => true)));
\Propel::setLogger($this->container->get('propel.logger'));
}
\Propel::initialize();
}
}
示例10: initialize
/**
* Initialize sfymfony propel
*
* @param sfEventDispatcher $dispatcher
* @param string $culture
*/
public static function initialize(sfEventDispatcher $dispatcher, $culture = null)
{
if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) {
// add propel logger
Propel::setLogger(new sfPropelLogger($dispatcher));
}
// propel initialization
$configuration = sfPropelDatabase::getConfiguration();
if ($configuration) {
Propel::setConfiguration($configuration);
if (!Propel::isInit()) {
Propel::initialize();
}
}
$dispatcher->connect('user.change_culture', array('sfPropel', 'listenToChangeCultureEvent'));
if (!is_null($culture)) {
self::setDefaultCulture($culture);
} else {
if (class_exists('sfContext', false) && sfContext::hasInstance() && ($user = sfContext::getInstance()->getUser())) {
self::setDefaultCulture($user->getCulture());
}
}
self::$initialized = true;
}
示例11: define
$oPluginRegistry->unSerializeInstance(file_get_contents($sSerializedFile));
}
// setup propel definitions and logging
require_once "propel/Propel.php";
require_once "creole/Creole.php";
if (defined('DEBUG_SQL_LOG') && DEBUG_SQL_LOG) {
define('PM_PID', mt_rand(1, 999999));
require_once 'Log.php';
// register debug connection decorator driver
Creole::registerDriver('*', 'creole.contrib.DebugConnection');
// initialize Propel with converted config file
Propel::init(PATH_CORE . "config/databases.php");
// unified log file for all databases
$logFile = PATH_DATA . 'log' . PATH_SEP . 'propel.log';
$logger = Log::singleton('file', $logFile, 'wf ' . SYS_SYS, null, PEAR_LOG_INFO);
Propel::setLogger($logger);
// log file for workflow database
$con = Propel::getConnection('workflow');
if ($con instanceof DebugConnection) {
$con->setLogger($logger);
}
// log file for rbac database
$con = Propel::getConnection('rbac');
if ($con instanceof DebugConnection) {
$con->setLogger($logger);
}
// log file for report database
$con = Propel::getConnection('rp');
if ($con instanceof DebugConnection) {
$con->setLogger($logger);
}
示例12: _initDatabase
protected function _initDatabase()
{
if (Zend_Loader::isReadable(Dfi_App_Config::get('db.config'))) {
try {
$logger = Zend_Registry::get('propelLogger');
$adapter = new Dfi_Log_Adapter_Propel2Zend($logger);
require_once 'Propel.php';
Propel::setLogger($adapter);
Propel::init(Dfi_App_Config::get('db.config'));
} catch (Exception $e) {
throw new Exception('Can\'t setup database: ' . $e->getMessage());
}
} else {
throw new Exception('database config read failed');
}
}
示例13: date
}
//on prend une date le lundi matin à 9h40
$now = date('Y-m-d H:i',strtotime("next Monday 9:40"));
$edtCoursTest = $eleve->getEdtEmplacementCours($now);
echo ($logger->getDisplay());
if ($edtCoursTest != null && $edtCoursTest->getIdDefiniePeriode() == $edtCours2->getIdDefiniePeriode()) {
echo('test 3 recuperation emplacement de cours d\'un eleve a reussi<br/><br/>');
} else {
echo('test 3 recuperation emplacement de cours d\'un eleve a <font color="red">echoue</font> <br><br/>');
}
echo("<br/>");
purgeDonneesTest($logger);
Propel::setLogger(null);
function purgeDonneesTest($logger) {
echo "Purge des données<br/><br/>";
//purge de l'utilisateur
echo "<br/>Purge de l'utilisateur : <br/>";
$utilisateurProfessionnel = UtilisateurProfessionnelPeer::retrieveByPK(UnitTestUtilisateurProfessionnel::getUtilisateurProfessionnel()->getLogin());
if ($utilisateurProfessionnel != null) {
$utilisateurProfessionnel->delete();
}
$logger->getDisplay();
//purge du groupe
echo "<br/>Purge du groupe : <br/>";
$criteria = new Criteria();
$criteria->add(GroupePeer::NAME, UnitTestGroupe::getGroupe()->getName());
示例14: initPropel
/**
* Initializes Propel.
*/
private static function initPropel()
{
if (!file_exists(self::$config->curry->propel->conf)) {
self::log("Propel configuration missing, skipping propel initialization.");
return;
}
// Use Composer autoloader instead of the built-in propel autoloader
Propel::configure(self::$config->curry->propel->conf);
$config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
$classmap = array();
$projectClassPath = self::$config->curry->propel->projectClassPath;
foreach ($config['classmap'] as $className => $file) {
$classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file;
}
$level = error_reporting(error_reporting() & ~E_USER_WARNING);
Propel::initialize();
PropelAutoloader::getInstance()->unregister();
self::getAutoloader()->addClassMap($classmap);
error_reporting($level);
// Initialize debugging/logging
if (self::$config->curry->propel->debug) {
Propel::getConnection()->useDebug(true);
if (self::$logger && self::$config->curry->propel->logging) {
Propel::setLogger(self::$logger);
}
}
}
示例15: initPropel
/**
* Initializes Propel.
*/
protected function initPropel()
{
if (!file_exists($this['propel.conf'])) {
$this->logger->notice("Propel configuration missing, skipping propel initialization.");
return;
}
// Use Composer autoloader instead of the built-in propel autoloader
\Propel::configure($this['propel.conf']);
$config = \Propel::getConfiguration(\PropelConfiguration::TYPE_OBJECT);
$classmap = array();
$projectClassPath = $this['propel.projectClassPath'];
foreach ($config['classmap'] as $className => $file) {
$classmap[$className] = $projectClassPath . DIRECTORY_SEPARATOR . $file;
}
$level = error_reporting(error_reporting() & ~E_USER_WARNING);
\Propel::initialize();
\PropelAutoloader::getInstance()->unregister();
$this->autoloader->addClassMap($classmap);
error_reporting($level);
// Initialize debugging/logging
if ($this['propel.debug']) {
\Propel::getConnection()->useDebug(true);
if ($this['propel.logging']) {
\Propel::setLogger($this->logger);
}
}
}