When do we get to see halogen gas forming at the anode?
If the electrolyte has halogen in it
If the electrolyte has a simple ion like the halogens then the gas formed is halogen at anode. In case the electrolyte has either carbonates, nitrates or polyatomic ions then we are bound to see oxygen gas at the anode.