Added the ability to add the LoggingHandler when the debug flag is passed.