Now, you have to ask, “Why would a God of love ever bring pain into the lives of the people he says he loves?” The difficult things that you experience as God’s child that may seem like the result of God’s unfaithfulness and inattention or anger are actually acts of redemptive love. You see, in bringing these things into our lives God is actually fulfilling his covenantal commitment to satisfy the deepest needs of his people. And what is it that we need the most? The answer is simple and clear throughout all of Scripture: more than anything else we need him.That's just a short excerpt - read the whole thing!
Yet this is exactly where the rub comes in. Although our greatest personal need is to live in a life-shaping relationship with the Lord, as sinners we have hearts that have a propensity to wander. We very quickly forget God and begin to put ourselves or some aspect of the creation in his place. We soon forget that he’s to be the center of everything we think, desire, say and do. We easily lose sight of the fact that our hearts were designed for him and that the deep sense of well-being which all of us seek can only be found in him
Hat Tip; Desiring God , Vitamin Z