added backtrace to query logging