Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Database.php

function 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

\Drupal\Core\Database\Log

1 call to Database::getLog()
ViewUI::endQueryCapture in core/modules/views_ui/src/ViewUI.php
Add the list of queries run during render to build info.

File

core/lib/Drupal/Core/Database/Database.php, line 112

Class

Database
Primary front-controller for the database system.

Namespace

Drupal\Core\Database

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal