Add logging configuration.
This commit is contained in:
parent
83407453cc
commit
c97fe54152
4
pom.xml
4
pom.xml
@ -69,12 +69,12 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.7.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.2</version>
|
||||
<version>1.7.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
@ -1,17 +1,17 @@
|
||||
package com.hpcloud.mon;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import backtype.storm.Config;
|
||||
import backtype.storm.LocalCluster;
|
||||
import backtype.storm.StormSubmitter;
|
||||
import backtype.storm.generated.StormTopology;
|
||||
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
import ch.qos.logback.core.util.StatusPrinter;
|
||||
import com.hpcloud.util.Injector;
|
||||
import com.hpcloud.util.config.ConfigurationFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Alarm thresholding engine.
|
||||
@ -38,6 +38,10 @@ public class ThresholdingEngine {
|
||||
}
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
|
||||
// Let's show the logging status.
|
||||
StatusPrinter.print((LoggerContext) LoggerFactory.getILoggerFactory());
|
||||
|
||||
if (args.length < 2) {
|
||||
LOG.error("Expected configuration file name and topology name arguments");
|
||||
System.exit(1);
|
||||
|
@ -63,10 +63,12 @@ public abstract class KafkaSpout extends BaseRichSpout {
|
||||
|
||||
@Override
|
||||
public void nextTuple() {
|
||||
|
||||
LOG.debug("nextTuple called");
|
||||
ConsumerIterator<byte[], byte[]> it = streams.get(0).iterator();
|
||||
if (it.hasNext()) {
|
||||
processMessage(it.next().message(), collector);
|
||||
byte[] message = it.next().message();
|
||||
LOG.debug("Received message: " + message);
|
||||
processMessage(message, collector);
|
||||
}
|
||||
}
|
||||
|
||||
|
26
src/main/resources/logback.xml
Normal file
26
src/main/resources/logback.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<configuration scan="true" scanPeriod="30 seconds">
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- encoders are assigned the type
|
||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>mon-thresh.log</file>
|
||||
|
||||
<encoder>
|
||||
<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
|
||||
<logger name="com.hpcloud" level = "debug"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</configuration>
|
Loading…
Reference in New Issue
Block a user