Detect query name correctly
Output more logs