Some improvements to logging.