logging query