A few valuable quotes from Thomas Manton on Psalm 119:71:
Doctrine - That affliction, all things considered, is rather good than evil.
"The assertion is a paradox to vulgar sense, and the ears of the common sort of men. How few are there in the world that will grant that it is good to be afflicted! Yea, the children of God can scarcely subscribe to the truth of it, till the affliction is over. While they are under it, they feel the smart, but do not presently discern the benefit; but, in the review, they find that God hath ordered it with much wisdom and faithfulness; and in the issue they say as David doth, 'It is good for me that I have been afflicted.' "
"But affliction is good, because it many times maketh us the more earnestly to seek after him: 'In their affliction they will seek me early' (Hos. 5:15). Therefore every condition is good or evil as it sets further off, or draweth us nearer to God, capable of communion with him, conduceth to our everlasting happiness...If afflictions conduce to this end, they are good; for then they help us to enjoy the chief good."
"A discerning Christian puts more value upon holiness wrought by affliction, than upon all his comforts; so that, though affliction be evil in itself, it is good to be sanctified. "
"While God is striking, we feel the grief, and the cross is tedious; but when we see the end, we acknowledge it is good to be afflicted: 'No chastening for the present seemeth to be joyous, but grievous; nevertheless, afterward it yieldeth the peaceable fruit of righteousness' (Heb. 12:11)."
"Therefore good is not to be determined by feeling, but by faith."
(All quotes from Psalm 119 by Thomas Manton, Banner of Truth, 1990, pgs 111-114.)
And from Martin Luther we read, I want you to know how to study theology in the right way. I have practiced this method myself ... Here you will find three rules. They are frequently proposed throughout Psalm  and run thus: Oration, meditatio, tentatio (Prayer, meditation, trial). Concerning trials he stated that they teach you not only to know and understand but also to experience how right, how true, how sweet, how lovely, how mighty, how comforting God's word is: it is wisdom supreme. (Taken from What Luther Says: An Anthology, Vol. 3, p. 1359 and 1360.)
If you are struggling today these are comforting reminders that the trials you face are from our Lord and not by random chance. There is meaning and purpose. Struggle through them and be obedient and you will receive the blessing God has intended for you.