Change logging to only be enabled in debug mode

This should aide in performance benefits when doing large populations (though the developer should still disable SQL logging as well).
No worries, I made exactly the same mistake heh :)