-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include message with emails #849
Conversation
…essage will be sent in the header of any email that gets sent out becasue of that request.
@@ -287,6 +291,10 @@ private void prepareTaskMail(Optional<SingularityTask> task, SingularityTaskId t | |||
|
|||
final String body = Jade4J.render(taskTemplate, templateProperties); | |||
|
|||
if (LOG_EMAILS_FOR_DEBUG) { | |||
LOG.debug("TheMail: " + body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest logging this at the LOG.trace()
level instead, so that people can more easily control whether or not the email should be logged
These two issues have been fixed and the branch pushed again. |
Whoops, I lied before, forgot about making it trace level. Now they're both fixed. |
@@ -62,6 +68,10 @@ public void stop() { | |||
} | |||
|
|||
public void queueMail(final List<String> toList, final List<String> ccList, final String subject, final String body) { | |||
if (LOG_EMAILS_FOR_DEBUG) { | |||
LOG.trace("TheMail: " + body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do without the LOG_EMAILS_FOR_DEBUG
. We can control the logging level for each class in the configuration for Singularity, so just putting it at trace should be enough.
Also for logging, you can so something more like this rather that using "string" + "string"
LOG.trace("Sending email: {}, to: {}, cc: {}", body, toList, ccList)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readability I've found it to be easier to put the recipients first and the body last so you're not scrolling through a wall of HTML looking for the recipient at the end
Fixed |
@@ -30,6 +30,8 @@ | |||
|
|||
import io.dropwizard.lifecycle.Managed; | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super nit-picky, but can we get rid of these extra new lines here and down by the LOG.trace
Not sure how those got there in the first place, but they're gone now. |
Now that Singularity has the capability to accept optional user messages for tasks, these messages can be included in any emails sent because of user actions with messages. This commit includes that ability.
It also includes the ability to set a variable, LOG_EMAILS_FOR_DEBUG - If this variable is set to true, all emails sent will be logged in the debug logs. This allows local testing of emails without an SMTP server.