I would like to use log4j and send email in HTML format (Using SMTP Appender). Is it possible in log4j out of the box.
If so please point me to right examples
I would like to use log4j and send email in HTML format (Using SMTP Appender). Is it possible in log4j out of the box.
If so please point me to right examples
Logback provides a Layout that formats the logs as HTML. Combining that with an SMTPAppender would send email in HTML format.
http://logback.qos.ch/manual/layouts.html#ClassicHTMLLayout
Direct quote from the page:
The HTMLLayout is often used in conjunction with SMTPAppender so that outgoing email is pleasantly formatted in HTML.
You could even take the source code and modify it, pretty easily, to suit your needs.
http://logback.qos.ch/xref/ch/qos/logback/classic/html/HTMLLayout.html
<appender name="SMTP" class="ch.qos.logback.classic.net.SMTPAppender">
<layout class="ch.qos.logback.classic.html.HTMLLayout">
<pattern>%relative%thread%mdc%level%class%msg</pattern>
</layout>
<From>[email protected]</From>
<SMTPHost>mail.domain.net</SMTPHost>
<Subject>LastEvent: %class - %msg </Subject>
<To>[email protected]</To>
</appender>
-gMale