Enable logging only with debug flag.