Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added logging
  • Loading branch information
chenson42 committed Jun 21, 2011
1 parent 873bcc0 commit bd3e4df
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Expand Up @@ -131,10 +131,10 @@ public boolean hasNext() throws IOException {
return true;
} else if (tokens[0].equals(CsvConstants.NODEID)) {
this.context.setSourceNodeId(tokens[1]);
} else if (isMetaTokenParsed(tokens)) {
continue;
} else {
throw new RuntimeException("Unexpected token '" + tokens[0] + "' while parsing for next batch");
} else {
if (!isMetaTokenParsed(tokens)) {
log.debug("LoaderIgnoringToken", tokens[0]);
}
}
}
return false;
Expand Down
Expand Up @@ -242,9 +242,10 @@ protected List<IncomingBatch> loadDataAndReturnBatches(IIncomingTransport transp

IDataLoaderContext context = dataLoader.getContext();
while (dataLoader.hasNext()) {
batch = context.getBatch();
batch = context.getBatch();
if (parameterService.is(ParameterConstants.DATA_LOADER_ENABLED) ||
(batch.getChannelId() != null && batch.getChannelId().equals(Constants.CHANNEL_CONFIG))) {
(batch.getChannelId() != null && batch.getChannelId().equals(Constants.CHANNEL_CONFIG))) {
log.debug("LoaderProcessingBatch", batch.getBatchId());
list.add(batch);
loadBatch(dataLoader, batch);
}
Expand All @@ -257,7 +258,13 @@ protected List<IncomingBatch> loadDataAndReturnBatches(IIncomingTransport transp

for (IncomingBatch incomingBatch : list) {
// TODO I wonder if there is a way to avoid the second update?
incomingBatchService.updateIncomingBatch(incomingBatch);
if (incomingBatchService.updateIncomingBatch(incomingBatch) == 0) {
log.error("LoaderFailedToUpdateBatch", incomingBatch.getBatchId());
}
}

if (totalNetworkMillis > Constants.LONG_OPERATION_THRESHOLD && list.size() == 0) {
log.warn("LoaderNoBatchesLoadedWarning", totalNetworkMillis);
}

} catch (RegistrationRequiredException ex) {
Expand Down
Expand Up @@ -149,6 +149,10 @@ JobNoAutoStart=Job %s not configured for auto start
LauncherLogLocation=Log output will be written to %s
LauncherMissingArgument=Check the argument you passed in. --%s takes an argument of {groupId},{externalId}
LauncherMissingFilenameTriggerSQL=Please provide a file name to write the trigger SQL to
LoaderProcessingBatch=Processing batch %d
LoaderIgnoringToken=Ignoring csv token: %s
LoaderNoBatchesLoadedWarning=Spent %d ms in network transfer, but no batches were loaded!
LoaderFailedToUpdateBatch=Failed to update batch %d. Zero rows returned.
LoaderTableMissing=The data loader could not find the table: %s. Please ensure that the table exists and that the database user has access to it
LoaderTokenUnexpected=Unexpected token '%s' on line %d of batch %d
LoaderUpdatingFailedInserting=Unable to update %s, inserting instead: %s
Expand Down

0 comments on commit bd3e4df

Please sign in to comment.