File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -370,6 +370,12 @@ protected function logQueryToFile(string $sql): void {
370370 if ($ this ->systemConfig ->getValue ('query_log_file_requestid ' ) === 'yes ' ) {
371371 $ prefix .= Server::get (IRequestId::class)->getId () . "\t" ;
372372 }
373+ $ postfix = '' ;
374+ if ($ this ->systemConfig ->getValue ('query_log_file_backtrace ' ) === 'yes ' ) {
375+ $ trace = debug_backtrace (DEBUG_BACKTRACE_IGNORE_ARGS );
376+ array_pop ($ trace );
377+ $ postfix .= '; ' . json_encode ($ trace );
378+ }
373379
374380 // FIXME: Improve to log the actual target db host
375381 $ isPrimary = $ this ->connections ['primary ' ] === $ this ->_conn ;
@@ -378,7 +384,7 @@ protected function logQueryToFile(string $sql): void {
378384
379385 file_put_contents (
380386 $ this ->systemConfig ->getValue ('query_log_file ' , '' ),
381- $ prefix . $ sql . "\n" ,
387+ $ prefix . $ sql . $ postfix . "\n" ,
382388 FILE_APPEND
383389 );
384390 }
You can’t perform that action at this time.
0 commit comments