log optimization
This commit is contained in:
@@ -2,4 +2,4 @@
|
||||
logging.level.com.bayer=DEBUG
|
||||
#logging.level.com.bayer.edam.migration.interceptors=INFO
|
||||
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level- %msg%n
|
||||
logging.file=application_2017-11-16_QA_2.log
|
||||
logging.file=application_2017-11-16_QA_3_3.log
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Definitions {
|
||||
users = new HashMap<String, String>();
|
||||
|
||||
// XXX QA values
|
||||
classifications.put("Migration.Test", new WriteClassification("c07e583879a2409a8536a82d00f0ef5c", 1));
|
||||
classifications.put("Migration.Test", new WriteClassification("de8edf2ed8d2405b87dea82d01062d50", 1));
|
||||
|
||||
classifications.put("Migration", new WriteClassification("2bd24882-b7d8-4d30-8e6f-a7ef00eb33e7", 1));
|
||||
classifications.put("Migration.Logos", new WriteClassification("de96f8db1de44cc6841ba81c00b9db8e", 1));
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.HttpStatusCodeException;
|
||||
import org.springframework.web.client.ResourceAccessException;
|
||||
import org.springframework.web.client.RestClientException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@@ -108,19 +107,23 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
|
||||
List<Long> entrySelection;
|
||||
|
||||
// XXX
|
||||
|
||||
|
||||
// XXX ----------------------------------------------------------------
|
||||
// Option 1: Process all available entries
|
||||
// entrySelection = new ArrayList<Long>(entryMap.keySet());
|
||||
|
||||
// // XXX
|
||||
// Option 2: Process a fixed set of entry IDs
|
||||
entrySelection = Arrays.asList(71725L, 71263L, 71048L, 70778L, 70746L, 70745L, 70440L, 70361L, 70340L, 70288L, 70161L, 70142L,
|
||||
63924L, 63201L, 57641L, 56942L);
|
||||
|
||||
// XXX
|
||||
// Option 3: Read entry IDs from file
|
||||
// entrySelection = new ArrayList<Long>();
|
||||
// List<String> entryIDsList = FileUtils.readLines(new File("resources/lottery.txt"), Charset.forName("utf-8"));
|
||||
// for (String idString : entryIDsList) {
|
||||
// entrySelection.add(Long.parseLong(idString));
|
||||
// }
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -158,6 +161,8 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
// HttpEntity<String> entity = new HttpEntity<String>("", mamHeaders);
|
||||
for (long id : entrySelection) {
|
||||
|
||||
|
||||
|
||||
// XXX
|
||||
// // if needed start from a certain ID
|
||||
// if (id > 44741)
|
||||
@@ -527,19 +532,13 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
URI location = restTemplate.postForLocation(Definitions.adamHost + "/records", httpEntity, UploadRecord.class);
|
||||
log.info("RESULT Entry " + entry.id + " migrated to record " + location);
|
||||
|
||||
// XXX
|
||||
uploadFilesForEntry(entry, location);
|
||||
|
||||
log.info("FINAL " + entry.id + fieldSeparator + location.toString() + fieldSeparator + entryJson);
|
||||
}
|
||||
catch (HttpStatusCodeException hsce) {
|
||||
log.error("RESULT Skipping entry " + entry.id + ": Error while creating record " + hsce.getStatusCode().toString());
|
||||
log.error(hsce.getResponseBodyAsString());
|
||||
hsce.printStackTrace();
|
||||
}
|
||||
catch (ResourceAccessException rae) {
|
||||
log.error("RESULT Could not create record for entry " + entry.id + ": " + rae.getMessage());
|
||||
rae.printStackTrace();
|
||||
catch (RestClientException rce) {
|
||||
log.error("RESULT Could not create record for entry " + entry.id + ": " + rce.getMessage());
|
||||
rce.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,14 +678,13 @@ public class MamMigrationSelective implements CommandLineRunner {
|
||||
|
||||
try {
|
||||
ResponseEntity<Void> response = restTemplate.exchange(Definitions.adamHost + reference.targetRecord, HttpMethod.PUT, httpEntity, Void.class);
|
||||
log.debug("Response: " + response.toString());
|
||||
log.debug("ATTACH RESULT Attached " + reference.cachePath + " (" + reference.isMaster + ") to " + reference.targetRecord);
|
||||
}
|
||||
catch (RestClientException rce) {
|
||||
log.error("ATTACH RESULT Exception while attaching file " + reference.cachePath + " (" + reference.isMaster + ") for " + reference.targetRecord + ": " + rce.getMessage());
|
||||
rce.printStackTrace();
|
||||
}
|
||||
|
||||
log.debug("ATTACH RESULT Attached " + reference.cachePath + " (" + reference.isMaster + ") to " + reference.targetRecord);
|
||||
processedReferences.add(reference);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user