mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Improve logging for SendExpiringCertificateNotificationEmailAction.java (#1302)
* Improve logging for SendExpiringCertificateNotificationEmailAction.java
This commit is contained in:
parent
00d2767e88
commit
ee18f5cdf6
1 changed files with 16 additions and 5 deletions
|
@ -113,6 +113,8 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
ImmutableList<RegistrarInfo> getRegistrarsWithExpiringCertificates() {
|
ImmutableList<RegistrarInfo> getRegistrarsWithExpiringCertificates() {
|
||||||
|
logger.atInfo().log(
|
||||||
|
"Getting a list of registrars that should receive expiring notification emails.");
|
||||||
return Streams.stream(Registrar.loadAllCached())
|
return Streams.stream(Registrar.loadAllCached())
|
||||||
.map(
|
.map(
|
||||||
registrar ->
|
registrar ->
|
||||||
|
@ -167,6 +169,11 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable
|
||||||
.setRecipients(recipients)
|
.setRecipients(recipients)
|
||||||
.setCcs(getEmailAddresses(registrar, Type.ADMIN))
|
.setCcs(getEmailAddresses(registrar, Type.ADMIN))
|
||||||
.build());
|
.build());
|
||||||
|
logger.atInfo().log(
|
||||||
|
"Sent an email to inform registrar %s that its %s SSL certificate will expire on %s.",
|
||||||
|
registrar.getRegistrarName(),
|
||||||
|
certificateType.getDisplayName(),
|
||||||
|
DATE_FORMATTER.print(lastExpiringCertNotificationSentDate));
|
||||||
/*
|
/*
|
||||||
* A duration time offset is used here to ensure that date comparison between two
|
* A duration time offset is used here to ensure that date comparison between two
|
||||||
* successive dates is always greater than 1 day. This date is set as last updated date,
|
* successive dates is always greater than 1 day. This date is set as last updated date,
|
||||||
|
@ -198,17 +205,21 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable
|
||||||
newRegistrar.setLastExpiringCertNotificationSentDate(now);
|
newRegistrar.setLastExpiringCertNotificationSentDate(now);
|
||||||
tm().put(newRegistrar.build());
|
tm().put(newRegistrar.build());
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Updated last notification email sent date for %s certificate of "
|
"Updated last notification email sent date to %s for %s certificate of "
|
||||||
+ "registrar %s.",
|
+ "registrar %s.",
|
||||||
certificateType.getDisplayName(), registrar.getRegistrarName());
|
DATE_FORMATTER.print(now),
|
||||||
|
certificateType.getDisplayName(),
|
||||||
|
registrar.getRegistrarName());
|
||||||
break;
|
break;
|
||||||
case FAILOVER:
|
case FAILOVER:
|
||||||
newRegistrar.setLastExpiringFailoverCertNotificationSentDate(now);
|
newRegistrar.setLastExpiringFailoverCertNotificationSentDate(now);
|
||||||
tm().put(newRegistrar.build());
|
tm().put(newRegistrar.build());
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Updated last notification email sent date for %s certificate of "
|
"Updated last notification email sent date to %s for %s certificate of "
|
||||||
+ "registrar %s.",
|
+ "registrar %s.",
|
||||||
certificateType.getDisplayName(), registrar.getRegistrarName());
|
DATE_FORMATTER.print(now),
|
||||||
|
certificateType.getDisplayName(),
|
||||||
|
registrar.getRegistrarName());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
|
@ -251,7 +262,7 @@ public class SendExpiringCertificateNotificationEmailAction implements Runnable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.atInfo().log(
|
logger.atInfo().log(
|
||||||
"Sent %d expiring certificate notification emails to registrars.", emailsSent);
|
"Attempted to send %d expiring certificate notification emails.", emailsSent);
|
||||||
return emailsSent;
|
return emailsSent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue