How did a medieval chaplain learn his job?

Chaplains were nearly always priests who had learned theology either in a monastery school or a university.