logging query fix