ch.qos.logback.classic.net.SMTPAppenderCustom Maven / Gradle / Ivy
package ch.qos.logback.classic.net;
import ch.qos.logback.core.CoreConstants;
public class SMTPAppenderCustom extends ch.qos.logback.classic.net.SMTPAppender {
private long lastTrackerStatusPrint = 0;
private long delayBetweenStatusMessages = 300 * CoreConstants.MILLIS_IN_ONE_SECOND;
@Override
protected void append(ch.qos.logback.classic.spi.ILoggingEvent eventObject) {
long now = System.currentTimeMillis();
if (this.lastTrackerStatusPrint + this.delayBetweenStatusMessages < now) {
addInfo("SMTPAppender [" + this.name + "] is tracking [" + this.cbTracker.getComponentCount() + "] buffers");
this.lastTrackerStatusPrint = now;
super.append(eventObject);
}
}
public void setDelayBetweenStatusMessages(long delayBetweenStatusMessages) {
this.delayBetweenStatusMessages = delayBetweenStatusMessages;
}
}