Customkey ORM support and log code cleanup