Add logging

This commit is contained in:
jamesagnew 2021-05-18 12:33:02 -04:00
parent c725d1453f
commit e02bfca610
3 changed files with 16 additions and 4 deletions

View File

@ -71,6 +71,6 @@ public class BulkImportFileReader implements ItemReader<ParsedBulkImportRecord>
Logs.getBatchTroubleshootingLog().debug("Reading line {} file index {} for job: {}", myLineIndex++, myFileIndex, myJobUuid); Logs.getBatchTroubleshootingLog().debug("Reading line {} file index {} for job: {}", myLineIndex++, myFileIndex, myJobUuid);
IBaseResource parsed = myFhirContext.newJsonParser().parseResource(nextLine); IBaseResource parsed = myFhirContext.newJsonParser().parseResource(nextLine);
return new ParsedBulkImportRecord(myTenantName, parsed); return new ParsedBulkImportRecord(myTenantName, parsed, myLineIndex);
} }
} }

View File

@ -51,7 +51,13 @@ public class BulkImportFileWriter implements ItemWriter<ParsedBulkImportRecord>
@SuppressWarnings({"SwitchStatementWithTooFewBranches", "rawtypes", "unchecked"}) @SuppressWarnings({"SwitchStatementWithTooFewBranches", "rawtypes", "unchecked"})
@Override @Override
public void write(List<? extends ParsedBulkImportRecord> theItemLists) throws Exception { public void write(List<? extends ParsedBulkImportRecord> theItemLists) throws Exception {
ourLog.info("Beginning bulk import write {} chunks Job[{}] FileIndex[{}]", theItemLists.size(), myJobUuid, myFileIndex);
String offsets = "unknown";
if (theItemLists.size() > 0) {
offsets = theItemLists.get(0).getLineIndex() + " - " + theItemLists.get(theItemLists.size()-1).getLineIndex();
}
ourLog.info("Beginning bulk import write {} rows Job[{}] FileIndex[{}] Offset[{}]", theItemLists.size(), myJobUuid, myFileIndex, offsets);
StopWatch sw = new StopWatch(); StopWatch sw = new StopWatch();
for (ParsedBulkImportRecord nextItem : theItemLists) { for (ParsedBulkImportRecord nextItem : theItemLists) {
@ -71,7 +77,7 @@ public class BulkImportFileWriter implements ItemWriter<ParsedBulkImportRecord>
} }
ourLog.info("Completed bulk import write {} chunks Job[{}] FileIndex[{}] in {}", theItemLists.size(), myJobUuid, myFileIndex, sw); ourLog.info("Completed bulk import write {} rows Job[{}] FileIndex[{}] Offset[{}] in {}", theItemLists.size(), myJobUuid, myFileIndex, offsets, sw);
} }
} }

View File

@ -30,10 +30,16 @@ public class ParsedBulkImportRecord implements Serializable {
private final String myTenantName; private final String myTenantName;
private final IBaseResource myRowContent; private final IBaseResource myRowContent;
private final int myLineIndex;
public ParsedBulkImportRecord(String theTenantName, IBaseResource theRowContent) { public ParsedBulkImportRecord(String theTenantName, IBaseResource theRowContent, int theLineIndex) {
myTenantName = theTenantName; myTenantName = theTenantName;
myRowContent = theRowContent; myRowContent = theRowContent;
myLineIndex = theLineIndex;
}
public int getLineIndex() {
return myLineIndex;
} }
public String getTenantName() { public String getTenantName() {