Merge pull request #3945 from nextcloud/downstream-27298

Adding file, line, class and function to the query logger (#27298)
This commit is contained in:
Lukas Reschke 2017-03-20 13:16:10 +01:00 committed by GitHub
commit 450a899f01

View file

@ -66,8 +66,11 @@ class OC_DB_StatementWrapper {
*/
public function execute($input=array()) {
if(\OC::$server->getSystemConfig()->getValue( "log_query", false)) {
$backTrace = debug_backtrace();
$class = $backTrace[1]['class'] . ':' . $backTrace[1]['function'];
$file = substr($backTrace[0]['file'], strlen(\OC::$SERVERROOT)) . ':' . $backTrace[0]['line'];
$params_str = str_replace("\n", " ", var_export($input, true));
\OCP\Util::writeLog('core', 'DB execute with arguments : '.$params_str, \OCP\Util::DEBUG);
\OCP\Util::writeLog('core', "DB execute with arguments : $params_str in $class; $file", \OCP\Util::DEBUG);
}
$this->lastArguments = $input;
if (count($input) > 0) {