I am converting the body of my exception to a string, and then emailing that exception to a given address in java. I want to format my exception string with html to make it a human readable format, similar to how it is displayed on stack overflow. I was wondering if there are any libraries in Java which do this?
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
String body = stringWriter.toString();
//add html to body here
All these frameworks can produce HTML emails with a bit of configuration. The general approach is like this:
If you don't want to use logging in your app, you can write your own appender which reuses the existing formatters.