Test: fix this test to work in IntelliJ

This commit is contained in:
Michael McCandless 2014-12-08 15:10:56 -05:00 committed by mikemccand
parent b28fc1afa5
commit b0b96af746
1 changed files with 9 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import com.google.common.base.Predicate;
import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;
import org.apache.log4j.spi.LoggingEvent;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Field;
@ -1317,7 +1318,14 @@ public class InternalEngineTests extends ElasticsearchLuceneTestCase {
public void testIndexWriterIFDInfoStream() {
MockAppender mockAppender = new MockAppender();
Logger iwIFDLogger = Logger.getLogger("index.engine.internal.lucene.iw.ifd");
// Works when running this test inside Intellij:
Logger iwIFDLogger = LogManager.exists("org.elasticsearch.index.engine.internal.lucene.iw.ifd");
if (iwIFDLogger == null) {
// Works when running this test from command line:
iwIFDLogger = LogManager.exists("index.engine.internal.lucene.iw.ifd");
assertNotNull(iwIFDLogger);
}
Level savedLevel = iwIFDLogger.getLevel();
iwIFDLogger.addAppender(mockAppender);
iwIFDLogger.setLevel(Level.DEBUG);