Index: logback-core/src/main/java/ch/qos/logback/core/AppenderBase.java =================================================================== --- logback-core/src/main/java/ch/qos/logback/core/AppenderBase.java (revision 2265) +++ logback-core/src/main/java/ch/qos/logback/core/AppenderBase.java Tue May 19 17:06:49 CEST 2009 @@ -10,6 +10,7 @@ package ch.qos.logback.core; import java.util.List; +import java.util.concurrent.locks.ReentrantLock; import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.ContextAwareBase; @@ -57,11 +58,15 @@ private int exceptionCount = 0; static final int ALLOWED_REPEATS = 5; + private final ReentrantLock lock = new ReentrantLock(true); // we want a "fair" lock to avoid congestion - public synchronized void doAppend(E eventObject) { + + public void doAppend(E eventObject) { + lock.lock(); + + try { // WARNING: The guard check MUST be the first statement in the // doAppend() method. - // prevent re-entry. if (guard) { return; @@ -93,7 +98,10 @@ } finally { guard = false; } + } finally { + lock.unlock(); - } + } + } abstract protected void append(E eventObject);