migrated logging code from original MobSOS here