Never, is the short answer. Some grey areas do occasionally arise in relation to confession, however.
The seal of the confessional - sigillum confessionis - is a byword in Catholic circles for absolute and lifelong confidentiality. Canon 1388.1 of the 1983 Code of Canon Law has this to say:
A confessor who directly violates the seal of confession incurs an automatic excommunication reserved to the Apostolic See; if he does so only indirectly, he is to be punished in accord with the seriousness of the offense.
An excommunication is clearly a big deal, and an excommunication reserved to the Holy See is about as serious as it gets. Similar provisions are to be found at Canon 889 of the old 1917 Code of Canon Law and Canon 1456.1 of the 1990 Code of Canons of the Eastern Churches.
It does seem that the seal of the confessional is remarkably rarely violated. Fr. Gury, a 19th century theologian whose work I quote from below, had this to say:
It is almost unheard of for the seal of confession to be violated directly, even by priests who are unholy, who apostatise from the faith or who are insane. Theologians are unanimous in affirming that this is due to a very special manifestation of the Providence of God. Indirect disclosure of information which follows from the imprudence of the confessor is not so infrequent, however. A confessor must therefore be very careful never to say anything from which the sins of his penitents can be deduced.More recently, the well-known internet priest Fr John Zuhlsdorf ("Fr Z") has said:
In my experience even the worst of the liberal, dissenting, addle-headed yahoo priests I have known over the years have taken the Seal of confession absolutely seriously. They might say stupid things in the confessional, but they take the Seal seriously. Do not worry about this point when you go to confession.In some unusual cases, details of sins can be disclosed by the priest with the penitent's consent. This is the case with certain serious "reserved" sins which cannot be forgiven without first seeking the permission of the local diocese or the Holy See (violating the seal, as we have just seen, is one such sin). In such instances, the report made by the priest uses a pseudonym in place of the penitent's real name.
Such cases aside, Catholic theologians have long realised that there are some difficult situations in which it is not clear whether the seal is being violated, or where the priest is torn between the need to preserve the integrity of confession and some other serious moral principle. The best known chestnut here is the story of the altar boy who confesses to the priest that he has just put poison in the communion wine. Should the priest forget what he has just been told when he leaves the confessional, and go out and say Mass as normal? Similar dilemmas form part of the plots of Alfred Hitchcock's I Confess and Jimmy McGovern's Priest.
I have translated below some dilemmas posed in traditional Catholic manuals of moral theology, together with the answers put forward by the authors. (It should be noted that the final example was posited before the enactment of the 1917 Code of Canon Law, Canon 888.2 of which appears to contain a stronger prohibition against asking a penitent for the name of their accomplice.)
Prospero Lambertini (Benedict XIV), Casus Conscientiae (1762)
A parish priest learns in confession that his servant is a thief. He locks his chests, whereas he had previously not locked them, and he does not use that servant to count his money as he had done previously. Question: is he violating the seal?
I reply that he is. The reason is that he is acting and refraining from acting on the basis of knowledge gained in confession whereas under other circumstances he would not have acted or refrained from acting in this way. For this reason, he is making confession odious to his servant, since he is tacitly reproaching him, with the result that he is embarrassed and ashamed. This is contrary to the purpose of the sacramental seal, which was and is to avoid discouraging the faithful from confession by making it difficult. To do this is to violate completely the seal of confession.
Jean-Pierre Gury, Casus Conscientiae (1865)
1. Fulberius is a confessor. He is talkative and insufficiently discreet. He readily talks to others, particularly priests, about matters that he has heard about in confession. He feels no scruples about this because he is very careful not to mention any of his penitents by name. However, it often happens that those who listen to him come to realise who the penitents are.
2. Lawrence used to be a servant of Pontius. He stole 100 francs from Pontius. Since he had no money to make restitution, he asked his confessor if he would be willing to ask Pontius, even referring to him by name, if he was prepared to forgive him the debt. Pontius waived the debt, but he told many other people what had happened.
Questions 1. What is the obligation of the seal of confession?
2. Is any scope given for disclosing trivial information?
3. Is it lawful to follow a probable opinion as regards the subject matter of the seal or to act where the danger of information being revealed is probably absent?
4. Did Fulberius seriously violate the seal in the first case?
5. Did Pontius commit a serious sin against the seal of confession by making known Lawrence's act of theft?
Reply to question 1. 1. There is a very strict obligation to preserve the seal of confession on pain of mortal sin. This is clear from natural law, divine positive law and ecclesiastical law.
2. This obligation entails a strict rule in every case that under no possible circumstances may a priest reveal anything that he has heard in confession.
Reply to question 2. No scope is allowed for disclosing trivial information in cases of direct disclosure. This is because, even if the information is very trivial in itself, it would involve very serious danger for the whole of the law if it were disclosed.
Reply to question 3. No. The reason is that this is not simply a question of legality or illegality, but of removing any danger of wronging the faithful or doing injury to the sacrament.
Reply to question 4. Yes. This is because Fulberius' mode of conduct entailed, albeit indirectly, a proximate danger of disclosure. Nor is it an excuse that Fulberius did not mention anyone by name, because the seal is violated whenever someone in the vicinity can come to know who the penitent was from what is said.
Reply to question 5. Yes, if Pontius knew that the matter was made known to him by his servant's personal confessor after obtaining permission from him. In this regard, St Anthony says: "A person is bound to keep secret the subject matter of confession if he comes to find out its content, whether lawfully or unlawfully, indirectly or directly.... This includes a person to whom the confessor makes a disclosure with the permission of the penitent." St Thomas agrees, giving the following reason: "because he shares in some way in the act of the priest".
Augustin Lehmkuhl, Casus Conscientiae (1902)
Robert is the director of morals in a certain seminary. While he is hearing the confessions of his students, he discovers from the confession of one of them that there is a student who is trying to corrupt the others. He therefore orders the penitent to tell him the name of that student on pain of being sent away without absolution. When he has found out the name, he severely reprimands the student in question and, when he has uncovered the truth, he expels him from the seminary.
1. What prohibition applies to asking the name of an accomplice?
2. Is it permissible in any situation to ask about an accomplice?
3. What is to be said about Robert?
Question 1. Answer 1. It is prohibited, on pain of discretionary penalties, for a confessor, while acting as a confessor, to extract from a penitent on pain of denial of absolution the name or identity of an accomplice in order that the latter can be corrected or reprimanded.
Answer 2. Anyone who defends this practice as lawful is punished with excommunication reserved to the Roman Pontiff (Pius IX, Apostolicae Sedis; Benedict XIV, Ad Eradicandum).
Question 2. Answer 1. Formal questioning about an accomplice must be distinguished from material questioning. Formal questioning is when the confessor seeks to know who the accomplice is in his capacity as accomplice. Material questioning is when he seeks to find out information which enables him to understand correctly the penitent's sin, even if by chance the accomplice is made known at the same time. This kind of material questioning is not prohibited. Indeed, it should not be left out if its purpose is to find out what sin the penitent has committed and his status and to prescribe the necessary remedies.
Answer 2. Sometimes even formal questioning about an accomplice can be undertaken. However, this should not be undertaken by the confessor acting as confessor, but in some other capacity to which he happens to have been appointed which gives rise to a necessity of knowing who the accomplice is and an obligation on the part of the penitent to pass on this information. The constitution of Benedict XIV itself seems to approve of this practice....
Question 3. Answer 1. Robert had the right to require that the student who was the corrupting influence be made known to him, unless by chance the penitent reported him to a higher authority. He would therefore have been right to deny absolution to a penitent who was not willing to identify in any way the corrupting influence to him or to another person in authority. This is because the case related to a student who had corrupted many others and to the common good.
Answer 2. He would have been less justified if he had simply required the penitent to identify the malefactor to him alone. He was bound to leave this decision to the judgement of the penitent. However, if the penitent's preference was to make the information known to Robert, he would have been better advised to receive the penitent's denunciation outside confession. The absolution should definitely not have been delayed until the denunciation was made.