add trace level log to shared file locker keepAlive

This commit is contained in:
gtully 2016-02-04 13:28:23 +00:00
parent 8c4b5f485d
commit c17b7fdc7f
2 changed files with 10 additions and 2 deletions

View File

@ -94,7 +94,9 @@ public class SharedFileLocker extends AbstractLocker {
@Override
public boolean keepAlive() {
return lockFile != null && lockFile.keepAlive();
boolean result = lockFile != null && lockFile.keepAlive();
LOG.trace("keepAlive result: " + result + (name != null ? ", name: " + name : ""));
return result;
}
@Override
@ -116,5 +118,8 @@ public class SharedFileLocker extends AbstractLocker {
@Override
public void configure(PersistenceAdapter persistenceAdapter) throws IOException {
this.setDirectory(persistenceAdapter.getDirectory());
if (name == null) {
name = getDirectory().toString();
}
}
}

View File

@ -32,6 +32,7 @@ import org.apache.activemq.util.IOHelper;
import org.apache.activemq.util.LockFile;
import org.apache.activemq.util.ServiceStopper;
import org.apache.activemq.util.Wait;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.spi.LoggingEvent;
import org.junit.Assert;
@ -88,7 +89,9 @@ public class SharedFileLockerTest {
DefaultTestAppender appender = new DefaultTestAppender() {
@Override
public void doAppend(LoggingEvent event) {
logCounts.incrementAndGet();
if (event.getLevel() == Level.INFO) {
logCounts.incrementAndGet();
}
}
};