1 database.inc final public static Database::startLog($logging_key, $key = 'default')

Starts logging a given logging key on the specified connection.


$logging_key: The logging key to log.

$key: The database connection key for which we want to log.

Return value

DatabaseLog: The query log object. Note that the log object does support richer methods than the few exposed through the Database class, so in some cases it may be desirable to access it directly.

See also



core/includes/database/database.inc, line 1498
Core systems for the database layer.


Primary front-controller for the database system.


final public static function startLog($logging_key, $key = 'default') {
  if (empty(self::$logs[$key])) {
    self::$logs[$key] = new DatabaseLog($key);

    // Every target already active for this connection key needs to have the
    // logging object associated with it.
    if (!empty(self::$connections[$key])) {
      /* @var DatabaseConnection $connection */
      foreach (self::$connections[$key] as $connection) {

  /* @var DatabaseLog $logger */
  $logger = self::$logs[$key];
  return self::$logs[$key];