Chemiluminescent studies of excited Mg and Sr atoms with Cl2 in the beam-gas arrangement