Confession
We have all done it. Sinned and failed morally somehow to some degree. It is human and God has provided a way to deal with sin. Sin has to come out through the mouth by confession!
Unless we repent and forsake our sins they will be revealed on the great Day of Judgment. There will be no excuses. No ability to mitigate the seriousness of the sin. But the way out of sin and shame is a true confession. David elaborates on his confession in Psalm 51 when the prophet Nathan came to him after David had committed adultery with Bathsheba.
David wrote this Psalm and then gave it to the director of music, for use in public worship! David admitted his guilt not only before Nathan but also before the entire country because the entire nation of Israel was hurt by David's sin. Normally we would only confess our sins to God and to those who know of the sin. In David’s case, everyone in the palace and perhaps the whole nation knew what had happed with Bathsheba and he was conscious of how this affected the morality of the young men in the palace and what lessons they drew from their king's behaviour. This was not a private matter between David and Bathsheba, or David and Uriah's relatives. The king sinned, and all Israel suffered. So David confessed before all Israel.
Secondly, true confession admits that punishment is justified and forgiveness depends on God's mercy alone. David says that God is justified when he judges. He admits that his sinfulness is not only one of the outward actions; he is sinful at the very heart of his being. We must be broken and contrite when we come before God and those we have sinned against; we must not downplay our sin or blame the other person, but admit that we deserve judgment. David's family suffer immensely from his sin. And Uriah remains dead. Forgiveness does not imply the absence of temporal consequences for sin.
Friend praise God when we come to God with broken and contrite hearts; when we call out to God pleading for His mercy; when we depend only on the shed blood of Jesus to cover all our sins, God never turns his ear away. God always listens. Confessed sin is always forgiven.