Added advanced logMode support for queries