Matter of fact, smal time out then on with the day.
If you make a big deal you will regret it.
If you show that it upsets you ! He will do it again
My 2 yr, 9 mon old son did this after the birth of his brother because he was jealous of the time consuming attention of me changing his brother's diapers. I cleaned him exactly like I did the baby and put away the "big boy" underwear and treated him like a baby" - babytalking,
giving him the baby's toys and putting his toys away, etc. But never said a word about using the potty. He changed his mind quickly :)
Very Carefully. Potty training is a delicate matter. I don't think they are completely potty trained until they start school. And even then they can have accidents. I would make a appointment with his doctor. Discuss what is happening. I would even sit down in a quiet place and ask him why he did that. One question I would ask you, any new arrivals? New Baby?? If not I would punish him. Make sure he understands you will not tollerate any of that.
Time out for 3 minutes. Watch the potty story together. Reinforce positive potty habits.
Little boys are funny little guys. I was at a burial service. A little 3 y/o boy just drops his drawers and pees on someones grave marker. His mom has 6 children and he is the youngest. She tried everything to stop it. She just ended up getting pee on herself. Be glad he is not peeing on you.
I would interviene and try to modify this. Some times boys will be boys.