Adding file, line, class and function to the query logger (#27298)

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Thomas Müller 2017-03-06 11:44:25 +01:00 committed by Morris Jobke
parent 528a903a7b
commit 45567572c8
No known key found for this signature in database
GPG Key ID: 9CE5ED29E7FCD38A
1 changed files with 4 additions and 1 deletions

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) {