Cleanup logging flag for agent
Still allow nil to enable logging