Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit c25d1c2

Browse files
author
Dan Richelson
committed
Address PR comments. Change test logging to use logback.
1 parent 63662d2 commit c25d1c2

File tree

5 files changed

+24
-49
lines changed

5 files changed

+24
-49
lines changed

build.gradle

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@ apply plugin: 'idea'
66
apply plugin: 'com.github.johnrengelman.shadow'
77

88
configurations.all {
9-
// check for updates every build
9+
// check for updates every build for dependencies with: 'changing: true'
1010
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
1111
}
1212

1313
repositories {
14-
mavenCentral()
1514
mavenLocal()
16-
1715
// Before LaunchDarkly release artifacts get synced to Maven Central they are here along with snapshots:
18-
maven {
19-
url "https://oss.sonatype.org/content/groups/public/"
20-
}
16+
maven { url "https://oss.sonatype.org/content/groups/public/" }
17+
mavenCentral()
2118
}
2219

2320
allprojects {
@@ -38,7 +35,7 @@ dependencies {
3835
compile "redis.clients:jedis:2.8.0"
3936
testCompile "org.easymock:easymock:3.4"
4037
testCompile 'junit:junit:[4.10,)'
41-
testRuntime "org.slf4j:slf4j-simple:1.7.7"
38+
testRuntime "ch.qos.logback:logback-classic:1.1.3"
4239
}
4340

4441
jar {

src/main/java/com/launchdarkly/client/EventProcessor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@
1919
import java.util.concurrent.*;
2020

2121
class EventProcessor implements Closeable {
22-
ThreadFactory threadFactory = new ThreadFactoryBuilder()
23-
.setDaemon(true)
24-
.setNameFormat("LaunchDarkly-EventProcessor-%d")
25-
.build();
26-
private final ScheduledExecutorService scheduler =
27-
Executors.newSingleThreadScheduledExecutor(threadFactory);
22+
private final ScheduledExecutorService scheduler;
2823
private final Random random = new Random();
2924
private final BlockingQueue<Event> queue;
3025
private final String apiKey;
@@ -36,6 +31,11 @@ class EventProcessor implements Closeable {
3631
this.queue = new ArrayBlockingQueue<>(config.capacity);
3732
this.consumer = new Consumer(config);
3833
this.config = config;
34+
ThreadFactory threadFactory = new ThreadFactoryBuilder()
35+
.setDaemon(true)
36+
.setNameFormat("LaunchDarkly-EventProcessor-%d")
37+
.build();
38+
this.scheduler = Executors.newSingleThreadScheduledExecutor(threadFactory);
3939
this.scheduler.scheduleAtFixedRate(consumer, 0, config.flushInterval, TimeUnit.SECONDS);
4040
}
4141

src/main/java/com/launchdarkly/client/StreamProcessor.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,10 @@ else if (name.equals(INDIRECT_PATCH)) {
104104

105105
@Override
106106
public void onError(Throwable throwable) {
107-
logger.error("Encountered exception in LaunchDarkly client: " + throwable.getMessage());
107+
logger.warn("Encountered EventSource error", throwable);
108108
}
109109
};
110110

111-
112111
es = new EventSource.Builder(handler, URI.create(config.streamURI.toASCIIString() + "/features"))
113112
.headers(headers)
114113
.build();

src/test/resources/logback.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<configuration>
2+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
3+
<!-- encoders are assigned the type
4+
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
5+
<encoder>
6+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}:%line - %msg%n</pattern>
7+
</encoder>
8+
</appender>
9+
10+
<root level="debug">
11+
<appender-ref ref="STDOUT" />
12+
</root>
13+
</configuration>

src/test/resources/simplelogger.properties

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)