Bugfix
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package de.tilman.log4j;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Properties;
|
||||
|
||||
@@ -30,10 +32,13 @@ public class EmailCollector extends AppenderSkeleton {
|
||||
private String emailRecipient;
|
||||
private String emailSubject;
|
||||
|
||||
private SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,S");
|
||||
|
||||
public EmailCollector(int bufferSize, String smtpUser, String smtpPassword, String emailRecipient, String emailSubject) {
|
||||
this.setName("EmailCollector");
|
||||
this.bufferSize = bufferSize;
|
||||
lineBuffer = new LinkedList<String>();
|
||||
this.smtpUser= smtpUser;
|
||||
this.smtpUser = smtpUser;
|
||||
this.smtpPassword = smtpPassword;
|
||||
this.emailRecipient = emailRecipient;
|
||||
this.emailSubject = emailSubject;
|
||||
@@ -92,7 +97,7 @@ public class EmailCollector extends AppenderSkeleton {
|
||||
if (lineBuffer.size() >= bufferSize) {
|
||||
lineBuffer.removeFirst();
|
||||
}
|
||||
lineBuffer.add(event.toString());
|
||||
lineBuffer.add(formatter.format(new Date(event.getTimeStamp())) + " - " + event.getRenderedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -591,8 +591,9 @@ public class SyncTool {
|
||||
}
|
||||
|
||||
if (config.getString("SMTP user") != null) {
|
||||
BasicConfigurator.configure(new EmailCollector(200, config.getString("smtpuser"), config.getString("smtppassword"), config.getString("email"), "SyncTool Report"));
|
||||
BasicConfigurator.configure(new EmailCollector(200, config.getString("SMTP user"), config.getString("SMTP password"), config.getString("e-mail address"), "SyncTool Report"));
|
||||
log.info("Prepared e-mail report for " + config.getString("e-mail address"));
|
||||
|
||||
}
|
||||
|
||||
if (config.getString("jabber address") != null) {
|
||||
|
||||
Reference in New Issue
Block a user