It is said, in the tradition, revenge is for a hurt, justice is for a wrong. I read, somewhere, not long ago, in a thinker, the statement that: even a dog distinguishes between being kicked and being stumbled over. The pain of being stumbled over might be worse. Yet, by nature, if the dog is any measure, this is not something that deserves reprisal.
Eventually, starting from such dialectical and simple points, one can come to a theory of the injustice of revenge, and the justice of punishing a legal wrong based on intentionality. Yet, one can never leave it at that. And the discussion is ultimately thrown into the abyss, seeing how the instinctual opinions of dogs, may be nothing but conditioning, i.e., evolution, and of men, perhaps the trauma of a Freudian Father Figure. If all such considerations are baseless, or merely a matter of various forms of control, whether societal or through physical determination, etc...
Did you mean, however, that revenge means taking the law into one's own hands, rather than that of the authority of a public agency? Conifold, as you see, speaks correctly, in saying that here we have a vast area, and some qualification is needed to usefully attempt to elucidate and so to investigate the matter of a specific consideration.