logging queries