From 8c6db4a2c98a72b5ea46e1d3fe429525dc3f3f21 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sun, 14 Feb 2016 18:04:10 +0100 Subject: [PATCH] Improve logging in SendMailSSL - for #522 --- src/main/java/fr/xephi/authme/mail/SendMailSSL.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/fr/xephi/authme/mail/SendMailSSL.java b/src/main/java/fr/xephi/authme/mail/SendMailSSL.java index 8279b8dfa..c80001c34 100644 --- a/src/main/java/fr/xephi/authme/mail/SendMailSSL.java +++ b/src/main/java/fr/xephi/authme/mail/SendMailSSL.java @@ -46,8 +46,7 @@ public class SendMailSSL { try { email = initializeMail(auth, settings); } catch (EmailException e) { - ConsoleLogger.showError("Failed to create email with the given settings: " - + StringUtils.formatException(e)); + ConsoleLogger.logException("Failed to create email with the given settings:", e); return; } @@ -59,8 +58,8 @@ public class SendMailSSL { file = generateImage(auth, plugin, newPass); content = embedImageIntoEmailContent(file, email, content); } catch (IOException | EmailException e) { - ConsoleLogger.showError("Unable to send new password as image for email " + auth.getEmail() - + ": " + StringUtils.formatException(e)); + ConsoleLogger.logException( + "Unable to send new password as image for email " + auth.getEmail() + ":", e); } } @@ -114,15 +113,14 @@ public class SendMailSSL { email.setHtmlMsg(content); email.setTextMsg(content); } catch (EmailException e) { - ConsoleLogger.showError("Your email.html config contains an error and cannot be sent: " - + StringUtils.formatException(e)); + ConsoleLogger.logException("Your email.html config contains an error and cannot be sent:", e); return false; } try { email.send(); return true; } catch (EmailException e) { - ConsoleLogger.showError("Failed to send a mail to " + email.getToAddresses() + ": " + e.getMessage()); + ConsoleLogger.logException("Failed to send a mail to " + email.getToAddresses() + ":", e); return false; } }