Our Gemara on Amud Beis discusses the famous principle:


אָדָם קָרוֹב אֵצֶל עַצְמוֹ, וְאֵין אָדָם מֵשִׂים עַצְמוֹ רָשָׁע

A person is his own relative. Consequently, he may not testify about himself, just as the testimony of any relative is disqualified. And furthermore, a person does not make himself wicked. His testimony with regard to his own actions is inadmissible because he is his own relative.


There is a beautiful Shalah (Aseres Hadibros, Yoma, Torah Ohr 23) that offers a way to understand the value of viduy (confession) in the repentance process. Since we have this rule, that one is not believed to incriminate himself (in regard to being subject to fines or punishments, not monetary admissions), if one confessed his sins to God, he will no longer be held liable for punishment. His testimony is, so to speak, inadmissible in the heavenly court.


There are also documented psychological benefits to confession. According to famed researcher and psychologist James Pennabaker. Pennabaker has reviewed and conducted numerous studies that facing and writing about one's darkest secrets improve health and well-being, with the proviso that one is utterly honest with oneself. (Of course make sure your private writings stay safely private!)


Pennabaker says, “putting emotional turmoil into words changes how we think about it. Giving concrete form to secret experiences can help categorize them in new ways. For instance, when we translate emotional experiences into words and stories, we start to think about them in a simpler, less menacing context. There is no solid evidence to explain this phenomenon, but it most likely occurs because talking or writing about a disturbing event helps us understand it better. And things we do not understand cause greater anxiety.”


Source: https://www.scientificamerican.com/article/does-confessing-secrets-improve-our-mental-health/