@@ -63,24 +63,31 @@ public void executeClosure() {
6363 TransportRunner .sendMessage (operationalConfig .getClusterKey (), session , message , message .getAllRecipients ());
6464 }
6565 } catch (final UnsupportedEncodingException e ) {
66- LOGGER .error ("Failed to send email:\n {}" , email );
66+ LOGGER .error ("Failed to send email:\n {}" , email .getId ());
67+ LOGGER .trace ("{}" , email );
6768 throw new MailerException (MailerException .INVALID_ENCODING , e );
6869 } catch (final MessagingException e ) {
69- LOGGER .error ("Failed to send email:\n {}" , email );
70+ LOGGER .error ("Failed to send email:\n {}" , email .getId ());
71+ LOGGER .trace ("{}" , email );
7072 throw new MailerException (MailerException .GENERIC_ERROR , e );
7173 } catch (final Exception e ) {
72- LOGGER .error ("Failed to send email:\n {}" , email );
74+ LOGGER .error ("Failed to send email:\n {}" , email .getId ());
75+ LOGGER .trace ("{}" , email );
7376 throw e ;
7477 }
7578 }
7679
7780 private void logEmail (final MimeMessage message ) {
7881 if (transportModeLoggingOnly ) {
79- LOGGER .info ("\n \n Email: {}\n " , email );
80- LOGGER .info ("\n \n MimeMessage: {}\n " , mimeMessageToEML (message ));
82+ if (LOGGER .isInfoEnabled ()) {
83+ LOGGER .info ("\n \n Email: {}\n " , email );
84+ LOGGER .info ("\n \n MimeMessage: {}\n " , mimeMessageToEML (message ));
85+ }
8186 } else {
82- LOGGER .trace ("\t \n Email: {}" , email );
83- LOGGER .trace ("\t \n MimeMessage: {}\n " , mimeMessageToEML (message ));
87+ if (LOGGER .isTraceEnabled ()) {
88+ LOGGER .trace ("\t \n Email: {}" , email );
89+ LOGGER .trace ("\t \n MimeMessage: {}\n " , mimeMessageToEML (message ));
90+ }
8491 }
8592 }
8693}
0 commit comments