|
@@ -12,6 +12,7 @@ import ch.qos.logback.classic.spi.IThrowableProxy;
|
|
import ch.qos.logback.core.AppenderBase;
|
|
import ch.qos.logback.core.AppenderBase;
|
|
import ch.qos.logback.core.Layout;
|
|
import ch.qos.logback.core.Layout;
|
|
import ch.qos.logback.core.spi.FilterReply;
|
|
import ch.qos.logback.core.spi.FilterReply;
|
|
|
|
+import com.chelvc.framework.base.context.ApplicationContextHolder;
|
|
import com.chelvc.framework.base.util.SpringUtils;
|
|
import com.chelvc.framework.base.util.SpringUtils;
|
|
import com.chelvc.framework.common.util.StringUtils;
|
|
import com.chelvc.framework.common.util.StringUtils;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
@@ -43,7 +44,6 @@ public class LogbackEmailAppender extends AppenderBase<ILoggingEvent> implements
|
|
private long idle = 60000;
|
|
private long idle = 60000;
|
|
private Layout<ILoggingEvent> layout;
|
|
private Layout<ILoggingEvent> layout;
|
|
|
|
|
|
-
|
|
|
|
private final Lock lock = new ReentrantLock();
|
|
private final Lock lock = new ReentrantLock();
|
|
private final Map<Integer, Long> caches = Maps.newConcurrentMap();
|
|
private final Map<Integer, Long> caches = Maps.newConcurrentMap();
|
|
|
|
|
|
@@ -115,7 +115,8 @@ public class LogbackEmailAppender extends AppenderBase<ILoggingEvent> implements
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void append(ILoggingEvent event) {
|
|
protected void append(ILoggingEvent event) {
|
|
- if (!this.isReady() || LogbackEmailAppender.class.getName().equals(event.getLoggerName())
|
|
|
|
|
|
+ boolean enabled = ApplicationContextHolder.getProperty("logback.email.enabled", boolean.class, true);
|
|
|
|
+ if (!enabled || !this.isReady() || LogbackEmailAppender.class.getName().equals(event.getLoggerName())
|
|
|| (event.getLevel() == Level.ERROR && this.isDuplicated(event))) {
|
|
|| (event.getLevel() == Level.ERROR && this.isDuplicated(event))) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|