logging fixes for when sqlalchemy debugging is enabled and tries to log while its being created