Use slf4j simple logger to get logs to stdout

Logs were heading over to log4j before this; were they getting lost?
This commit is contained in:
Ron Kuris 2014-12-01 21:52:52 -08:00
parent 9d5c551781
commit 09bbb55fb1
3 changed files with 15 additions and 3 deletions

View File

@ -39,11 +39,18 @@ dependencies {
compile 'org.apache.kafka:kafka_2.10:0.8.1.1+'
compile 'org.slf4j:log4j-over-slf4j:1.7.6'
compile 'org.slf4j:slf4j-simple:1.7.6'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
testCompile 'cglib:cglib-nodep:2.2.+'
}
////////////////////////////////////////////////////////////////////////////////
configurations {
compile.exclude module: 'log4j'
compile.exclude module: 'slf4j-log4j12'
}
test {
testLogging {

View File

@ -4,11 +4,13 @@ import kafka.consumer.ConsumerConfig;
import kafka.consumer.KafkaStream;
import kafka.javaapi.consumer.ConsumerConnector;
import offtopic.curator.CuratorPool
import groovy.util.logging.Slf4j
/**
* KafkaSubscriber is a Kafka consumer consumer, largely cribbed from:
* https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Group+Example
*/
@Slf4j
class KafkaSubscriber {
String topic
@ -38,7 +40,7 @@ class KafkaSubscriber {
public void consume() {
if (this.consumer == null) {
println "no consumer, gtfo"
log.warn "no consumer, gtfo"
return
}

View File

@ -1,9 +1,12 @@
package offtopic
import groovy.util.logging.Slf4j
/**
* OfftopicClient coordinates the interactions between KafkaSubscriber objects
* and the websocket interactions
*/
@Slf4j
class OfftopicClient {
public int clientId = 0
@ -44,9 +47,9 @@ class OfftopicClient {
this.subscribers.each { subscriber ->
Thread runner = new Thread({
subscriber.connect()
println "subscriber connected"
log.info "subscriber connected"
subscriber.consume()
println "consume over!"
log.info "consume over!"
})
runner.start()
}