Fix wrong nesting of if() conditions. In the old version, the indented
"if(logDEBUG)" would absorb the if()s below it, which was NOT the
intention behind the code. This fixes bug 5802.