aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/DB
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/DB')
-rw-r--r--lib/private/DB/Connection.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index 1340a388571..f704f12d8a8 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -370,6 +370,12 @@ class Connection extends PrimaryReadReplicaConnection {
if ($this->systemConfig->getValue('query_log_file_requestid') === 'yes') {
$prefix .= Server::get(IRequestId::class)->getId() . "\t";
}
+ $postfix = '';
+ if ($this->systemConfig->getValue('query_log_file_backtrace') === 'yes') {
+ $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+ array_pop($trace);
+ $postfix .= '; ' . json_encode($trace);
+ }
// FIXME: Improve to log the actual target db host
$isPrimary = $this->connections['primary'] === $this->_conn;
@@ -378,7 +384,7 @@ class Connection extends PrimaryReadReplicaConnection {
file_put_contents(
$this->systemConfig->getValue('query_log_file', ''),
- $prefix . $sql . "\n",
+ $prefix . $sql . $postfix . "\n",
FILE_APPEND
);
}