mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
feat: add option to add backtrace to the query logger
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
d82fb01b0a
commit
d6be80ceaf
1 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue