Duplicate query logger with backtraces