Magnetic X-ray spectroscopy of two-dimensional CrI3 layers