Writing to query logs working perfectly