The Office of the Judge (Kitab Al-Aqdiyah)
Dawud :: Book 24 : Hadith 3585
Narrated Mu'adh ibn Jabal:
Some companions of Mu'adh ibn Jabal said: When the Apostle of Allah (peace_be_upon_him) intended to send Mu'adh ibn Jabal to the Yemen, he asked: How will you judge when the occasion of deciding a case arises?
He replied: I shall judge in accordance with Allah's Book. He asked: (What will you do) if you do not find any guidance in Allah's Book? He replied: (I shall act) in accordance with the Sunnah of the Apostle of Allah (peace_be_upon_him).
He asked: (What will you do) if you do not find any guidance in the Sunnah of the Apostle of Allah (peace_be_upon_him) and in Allah's Book?
He replied: I shall do my best to form an opinion and I shall spare no effort.
The Apostle of Allah (peace_be_upon_him) then patted him on the breast and said: Praise be to Allah Who has helped the messenger of the Apostle of Allah to find something which pleases the Apostle of Allah.