fix logging of exceptions, reformatting

most change lines are formatting... the real changes are just adding logging.