提交 3559c049 编写于 作者: A allenxwang

Merge pull request #11 from allenxwang/master

Enable junit tests logging
...@@ -29,6 +29,8 @@ subprojects { ...@@ -29,6 +29,8 @@ subprojects {
compile 'commons-collections:commons-collections:3.2.1' compile 'commons-collections:commons-collections:3.2.1'
testCompile 'junit:junit:4.10' testCompile 'junit:junit:4.10'
testCompile 'log4j:log4j:1.2.16' testCompile 'log4j:log4j:1.2.16'
testCompile 'org.slf4j:slf4j-log4j12:1.6.4'
} }
} }
......
...@@ -27,6 +27,9 @@ import java.util.Map; ...@@ -27,6 +27,9 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.junit.AfterClass;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
...@@ -36,6 +39,7 @@ public class SimpleRoundRobinLBTest { ...@@ -36,6 +39,7 @@ public class SimpleRoundRobinLBTest {
@BeforeClass @BeforeClass
public static void setup(){ public static void setup(){
LogManager.getRootLogger().setLevel((Level)Level.DEBUG);
isAliveMap.put("dummyservice0.netflix.com:8080", Boolean.TRUE); isAliveMap.put("dummyservice0.netflix.com:8080", Boolean.TRUE);
isAliveMap.put("dummyservice1.netflix.com:8080", Boolean.TRUE); isAliveMap.put("dummyservice1.netflix.com:8080", Boolean.TRUE);
isAliveMap.put("dummyservice2.netflix.com:8080", Boolean.TRUE); isAliveMap.put("dummyservice2.netflix.com:8080", Boolean.TRUE);
...@@ -62,6 +66,10 @@ public class SimpleRoundRobinLBTest { ...@@ -62,6 +66,10 @@ public class SimpleRoundRobinLBTest {
System.out.println(lb.getServerList(true)); System.out.println(lb.getServerList(true));
} }
@AfterClass
public static void cleanup() {
LogManager.getRootLogger().setLevel((Level)Level.INFO);
}
/** /**
* Simulate a single user who should just round robin among the available servers * Simulate a single user who should just round robin among the available servers
*/ */
......
log4j.rootCategory=INFO,stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %-5p %C:%L [%t] [%M] %m%n
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册