Skip to content

Commit 61c3d0c

Browse files
committed
Added logs statements for debugging
1 parent fd5ee6e commit 61c3d0c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/dynamok/sink/DynamoDbSinkTask.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.amazonaws.auth.BasicAWSCredentials;
2121
import com.amazonaws.auth.InstanceProfileCredentialsProvider;
2222
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
23-
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;
2423
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
2524
import com.amazonaws.services.dynamodbv2.model.*;
2625
import com.fasterxml.jackson.core.JsonParseException;
@@ -105,17 +104,18 @@ public void put(Collection<SinkRecord> records) {
105104
client.putItem(tableName(record), toPutRequest(newRecord).getItem());
106105
} catch (JsonParseException | JsonMappingException e) {
107106
log.error("Exception occurred while converting JSON to Map: {}", record, e);
108-
log.info("Sending to error topic...");
107+
log.warn("Sending to error topic...");
109108
producer.send(producerRecord);
110109
} catch (LimitExceededException | ProvisionedThroughputExceededException e) {
111110
log.debug("Write failed with Limit/Throughput Exceeded exception; backing off");
112111
context.timeout(config.retryBackoffMs);
113112
throw new RetriableException(e);
114113
} catch (IOException e) {
115-
log.error("Exception occurred in Json Parsing ", e);
114+
log.error("Exception occurred in Json Parsing", e);
116115
producer.send(producerRecord);
117-
} catch(AmazonDynamoDBException e) {
118-
if (e.getErrorCode().equalsIgnoreCase( "ValidationException")) {
116+
} catch (AmazonDynamoDBException e) {
117+
log.warn("Error in sending data to DynamoDB in record: {}", record, e);
118+
if (e.getErrorCode().equalsIgnoreCase("ValidationException")) {
119119
producer.send(producerRecord);
120120
} else throw e;
121121
}

0 commit comments

Comments
 (0)