Fix log init order. Add debug