It is a good thing to pour out your heart and confess all your sins before a Torah scholar.
Sin is in essence a denial of Godliness.
Therefore when a person confesses his sins it is an acknowledgement of the sovereignty of God. God's sovereignty is then exalted and restored to its root, and the power of the forces denying Godliness is broken. Through confessing in this way and expressing what is in your heart you will eventually come to understand how everything that happens is for your own good. This is the formula of the blessing we make on hearing good news. Today, we still have a separate blessing for news that is not good.