It is truly an ignorant person who complains about Allāh to people. Such a person has displayed the deepest depths of ignorance concerning both Allāh and people: if he truly knew Allāh, he would never complain about Him; if he truly understood people, he would never complain to them.
One of the pious predecessors saw a person complaining to another about his desperate state of affairs and commented, ‘What have you achieved besides complaining to someone who will not show you mercy, leaving the One who will?’
When you complain to the son of Adam
You have left the Merciful for one who is not.
Someone who truly knows Allāh will only ever complain to Him. Amongst this category of people, the best is the person who complains to Allāh, not about other people, but about himself (and his spiritual condition). This person has grasped the real reason behind his difficulties and is looking to His words, “Any disaster that strikes you is through what your hands have earned,” (Q42:30) “Any bad things that happens to you come from yourself,” (Q4:79) “Why is it that when a calamity happens to you, when you have already inflicted twice as much, you say, ‘How could this possibly happen?’ Say, ‘It has come from your own selves.’” (Q3:165)
Therefore, there are three levels of people: the meanest is the person who complains about Allah to people, the most sublime is the person who complains about himself to Allāh, and middlemost is the person who complains about other people to Allāh.
Ibn al-Qayyim, al-Fawāʾid, pg. 126