Liferay version: 5.2.3 - 6.x
Step 1: Configure the log4j.properties
Step 2: Extend the SMTPAppender.java to use the liferay email configuration. By default it uses the SMTPAppender for sending the email. It may throw the error STARTTLS... So for skipping this error I used Liferay Mail Service for sending the email.
Step 3: By default the email is send for the Log Level ERROR and level which has higher priority. So if you need to send the email for particular exception use _log.error(e);
Eg:
public class Abc {
public static void Main(String args[]) {
Log _log = LoggerFactoryUtil.getLog(Abc.class);
_log.error("Its an error. Please fix it soon..");
}
}
No comments:
Post a Comment