Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

Commit

Permalink
Minor improve log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsimsek committed Aug 13, 2021
1 parent 76082db commit c87f058
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected long uploadDestination(String destination, JsonlinesBatchFile jsonLine
try (BufferedReader br = new BufferedReader(new FileReader(jsonLinesFile.getFile().getAbsolutePath()))) {
String line;
while ((line = br.readLine()) != null) {
LOGGER.trace("SparkWriter.uploadDestination Json file:{} line val:{}", fileName, line);
LOGGER.trace("Spark uploadDestination Json file:{} line val:{}", fileName, line);
}
} catch (Exception e) {
LOGGER.warn("Exception happened during debug logging!", e);
Expand Down Expand Up @@ -105,7 +105,7 @@ protected long uploadDestination(String destination, JsonlinesBatchFile jsonLine

if (LOGGER.isTraceEnabled()) {
df.toJavaRDD().foreach(x ->
LOGGER.trace("SparkWriter.uploadDestination row val:{}", x.toString())
LOGGER.trace("Spark uploadDestination row val:{}", x.toString())
);
}
df.unpersist();
Expand Down Expand Up @@ -134,13 +134,10 @@ public JsonlinesBatchFile getJsonLines(String destination, List<ChangeEvent<Obje
Object val = e.value();
Object key = e.key();

// this could happen if multiple threads reading and removing data
if (val == null) {
LOGGER.warn("Cache.getJsonLines Null Event Value found for destination:'{}'! " +
"skipping the entry!", destination);
LOGGER.warn("Null Value received skipping the entry! destination:{} key:{}", destination, getString(key));
continue;
}
LOGGER.trace("Cache.getJsonLines val:{}", getString(val));

if (isFirst) {
valSchema = BatchUtil.getJsonSchemaNode(getString(val));
Expand All @@ -155,8 +152,8 @@ public JsonlinesBatchFile getJsonLines(String destination, List<ChangeEvent<Obje
final String valData = mapper.writeValueAsString(valNode) + System.lineSeparator();

if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Cache.getJsonLines val Json Node:{}", valNode.toString());
LOGGER.trace("Cache.getJsonLines val String:{}", valData);
LOGGER.trace("Event value Json Node:{}", valNode.toString());
LOGGER.trace("Event value String:{}", valData);
}

fos.write(valData.getBytes(StandardCharsets.UTF_8));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public Dataset<Row> dataToSparkDf(String destination, List<ChangeEvent<Object, O
final Object val = event.value();

if (val == null) {
LOGGER.warn("Null Event Value found for destination:'{}'! skipping the entry!", destination);
LOGGER.warn("Null Value received skipping the entry! destination:{} key:{}", destination, getString(event.key()));
continue;
}

Expand Down

0 comments on commit c87f058

Please sign in to comment.