Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53200 Enable selective logging of slow/failed queries