[PR #1] improving logging

This commit is contained in:
Guillaume Polaert 2017-05-02 16:52:03 +02:00
parent dec780b74c
commit 3fa20e3106
1 changed files with 8 additions and 10 deletions

View File

@ -1,17 +1,15 @@
package com.datadoghq.trace.writer.impl;
import com.datadoghq.trace.impl.DDSpanSerializer;
import io.opentracing.Span;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.datadoghq.trace.impl.DDSpanSerializer;
import io.opentracing.Span;
/**
* The API pointing to a DD agent
*/
@ -62,10 +60,10 @@ public class DDApi {
int status = callPUT(tracesEndpoint, payload);
if (status == 200) {
logger.debug("Succesfully sent " + traces.size() + " traces to the DD agent.");
logger.debug("Succesfully sent {} traces to the DD agent.", traces.size());
return true;
} else {
logger.warn("Error while sending " + traces.size() + " traces to the DD agent. Status: " + status);
logger.warn("Error while sending {} traces to the DD agent. Status: {}", traces.size(), status);
return false;
}
}
@ -98,7 +96,7 @@ public class DDApi {
if (responseCode != 200) {
logger.debug("Sent the payload to the DD agent.");
} else {
logger.warn("Could not send the payload to the DD agent. Status: " + httpCon.getResponseCode() + " ResponseMessage: " + httpCon.getResponseMessage());
logger.warn("Could not send the payload to the DD agent. Status: {} ResponseMessage: {}", httpCon.getResponseCode(), httpCon.getResponseMessage());
}
return responseCode;
} catch (Exception e) {