final public static function Database::startLog

Starts logging a given logging key on the specified connection.

Parameters

$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

DatabaseLog

5 calls to Database::startLog()
DatabaseLoggingTestCase::testEnableLogging in drupal/modules/simpletest/tests/database_test.test
Test that we can log the existence of a query.
DatabaseLoggingTestCase::testEnableMultiConnectionLogging in drupal/modules/simpletest/tests/database_test.test
Test that we can log queries separately on different connections.
DatabaseLoggingTestCase::testEnableMultiLogging in drupal/modules/simpletest/tests/database_test.test
Test that we can run two logs in parallel.
DatabaseLoggingTestCase::testEnableTargetLogging in drupal/modules/simpletest/tests/database_test.test
Test that we can log queries against multiple targets on the same connection.
DatabaseLoggingTestCase::testEnableTargetLoggingNoTarget in drupal/modules/simpletest/tests/database_test.test
Test that logs to separate targets collapse to the same connection properly.

File

drupal/includes/database/database.inc, line 1464
Core systems for the database layer.

Class

Database
Primary front-controller for the database system.

Code

public static final 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])) {
      foreach (self::$connections[$key] as $connection) {
        $connection
          ->setLogger(self::$logs[$key]);
      }
    }
  }
  self::$logs[$key]
    ->start($logging_key);
  return self::$logs[$key];
}