debuglevel and logging cleanup