CC-4275: Enable debug mode where all Propel queries are displayed in raw SQL

-add enablePropelLogging and disablePropelLogging functions
This commit is contained in:
Martin Konecny 2012-08-23 22:27:24 -04:00
parent 7cbe037c7e
commit 9893282e43
3 changed files with 84 additions and 70 deletions

View file

@ -69,4 +69,26 @@ class Logging {
$logger->debug("[$file : $function() : line $line] - ".self::toString($p_msg));
}
}
public static function enablePropelLogging()
{
$logger = Logging::getLogger();
Propel::setLogger($logger);
$con = Propel::getConnection();
$con->useDebug(true);
$config = Propel::getConfiguration(PropelConfiguration::TYPE_OBJECT);
$config->setParameter('debugpdo.logging.details.method.enabled', true);
$config->setParameter('debugpdo.logging.details.time.enabled', true);
$config->setParameter('debugpdo.logging.details.mem.enabled', true);
}
public static function disablePropelLogging()
{
$con = Propel::getConnection();
$con->useDebug(false);
Propel::setLogger(null);
}
}