List of usage examples for com.liferay.portal.kernel.log LogUtil log
public static void log(Log log, Throwable throwable)
From source file:com.liferay.taglib.util.IncludeTag.java
License:Open Source License
private void _doInclude(String page) throws JspException { try {// w w w .j a v a 2 s . c om include(page); } catch (Exception e) { HttpServletRequest request = getServletRequest(); String currentURL = (String) request.getAttribute(WebKeys.CURRENT_URL); _log.error("Current URL " + currentURL + " generates exception: " + e.getMessage()); LogUtil.log(_log, e); if (e instanceof JspException) { throw (JspException) e; } } }
From source file:com.liferay.util.mail.MailEngine.java
License:Open Source License
private static void _send(Session session, Message message, InternetAddress[] bulkAddresses) { try {/*w ww. j a v a 2s . c om*/ boolean smtpAuth = GetterUtil.getBoolean(_getSMTPProperty(session, "auth"), false); String smtpHost = _getSMTPProperty(session, "host"); int smtpPort = GetterUtil.getInteger(_getSMTPProperty(session, "port"), Account.PORT_SMTP); String user = _getSMTPProperty(session, "user"); String password = _getSMTPProperty(session, "password"); if (smtpAuth && Validator.isNotNull(user) && Validator.isNotNull(password)) { String protocol = GetterUtil.getString(session.getProperty("mail.transport.protocol"), Account.PROTOCOL_SMTP); Transport transport = session.getTransport(protocol); transport.connect(smtpHost, smtpPort, user, password); if ((bulkAddresses != null) && (bulkAddresses.length > 0)) { transport.sendMessage(message, bulkAddresses); } else { transport.sendMessage(message, message.getAllRecipients()); } transport.close(); } else { if ((bulkAddresses != null) && (bulkAddresses.length > 0)) { Transport.send(message, bulkAddresses); } else { Transport.send(message); } } } catch (MessagingException me) { if (me.getNextException() instanceof SocketException) { if (_log.isWarnEnabled()) { _log.warn("Failed to connect to a valid mail server. Please " + "make sure one is properly configured. " + me.getMessage()); } } else { _log.error(me.getMessage()); LogUtil.log(_log, me); } } }