function Database::getLog
Same name in other branches
- 7.x includes/database/database.inc \Database::getLog()
- 8.9.x core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::getLog()
- 10 core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::getLog()
- 11.x core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::getLog()
Retrieves the queries logged on for given logging key.
This method also ends logging for the specified key. To get the query log to date without ending the logger request the logging object by starting it again (which does nothing to an open log key) and call methods on it as desired.
Parameters
string $logging_key: The logging key to log.
string $key: The database connection key for which we want to log.
Return value
array The query log for the specified logging key and connection.
See also
7 calls to Database::getLog()
- LoggingTest::testEnableLogging in core/
tests/ Drupal/ KernelTests/ Core/ Database/ LoggingTest.php - Tests that we can log the existence of a query.
- LoggingTest::testEnableMultiConnectionLogging in core/
tests/ Drupal/ KernelTests/ Core/ Database/ LoggingTest.php - Tests that we can log queries separately on different connections.
- LoggingTest::testEnableMultiLogging in core/
tests/ Drupal/ KernelTests/ Core/ Database/ LoggingTest.php - Tests that we can run two logs in parallel.
- LoggingTest::testEnableTargetLogging in core/
tests/ Drupal/ KernelTests/ Core/ Database/ LoggingTest.php - Tests logging queries against multiple targets on the same connection.
- LoggingTest::testEnableTargetLoggingNoTarget in core/
tests/ Drupal/ KernelTests/ Core/ Database/ LoggingTest.php - Tests that logs to separate targets use the same connection properly.
File
-
core/
lib/ Drupal/ Core/ Database/ Database.php, line 152
Class
- Database
- Primary front-controller for the database system.
Namespace
Drupal\Core\DatabaseCode
public static final function getLog($logging_key, $key = 'default') {
if (empty(self::$logs[$key])) {
return [];
}
$queries = self::$logs[$key]->get($logging_key);
self::$logs[$key]->end($logging_key);
return $queries;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.