Commit 3ebc24f84eb4d4fe9ee5f568764c7f51afc09cea

Authored by Paulo Graça
1 parent 1c4bd90224
Exists in tests

PG: add logging

Showing 1 changed file with 9 additions and 3 deletions   Show diff stats
ptcrisync/src/pt/ptcris/PTCRISync.java
... ... @@ -3,6 +3,8 @@ package pt.ptcris;
3 3 import java.util.LinkedList;
4 4 import java.util.List;
5 5  
  6 +import org.apache.logging.log4j.LogManager;
  7 +import org.apache.logging.log4j.Logger;
6 8 import org.um.dsi.gavea.orcid.client.exception.OrcidClientException;
7 9 import org.um.dsi.gavea.orcid.model.work.Work;
8 10 import org.um.dsi.gavea.orcid.model.work.WorkSummary;
... ... @@ -15,7 +17,7 @@ import pt.ptcris.ORCIDHelper;
15 17 public class PTCRISync {
16 18  
17 19 private static ORCIDHelper helper;
18   -
  20 + private static final Logger _log = LogManager.getLogger(PTCRISync.class);
19 21 /**
20 22 * Export a list of works to an ORCID profile.
21 23 *
... ... @@ -37,10 +39,11 @@ public class PTCRISync {
37 39 helper = new ORCIDHelper(orcidClient);
38 40  
39 41 List<WorkSummary> orcidWorks = helper.getSourcedWorkSummaries();
40   -
41 42 List<UpdateRecord> recordsToUpdate = new LinkedList<UpdateRecord>();
42   -
  43 +
  44 +
43 45 progressHandler.setCurrentStatus("ORCID_SYNC_EXPORT_WORKS_ITERATION");
  46 + _log.info("[export] " + "ORCID_SYNC_EXPORT_WORKS_ITERATION");
44 47 for (int counter = 0; counter != orcidWorks.size(); counter++) {
45 48 progress = (int) ((double) ((double) counter / orcidWorks.size()) * 100);
46 49 progressHandler.setProgress(progress);
... ... @@ -50,6 +53,7 @@ public class PTCRISync {
50 53 helper.deleteWork(orcidWorks.get(counter).getPutCode());
51 54 } else {
52 55 for (Work localWork : matchingWorks) {
  56 + _log.debug("[export] Local work " + localWork.toString());
53 57 Work orcidWork = helper.getFullWork(orcidWorks.get(counter).getPutCode());
54 58 recordsToUpdate.add(new UpdateRecord(localWork, orcidWork));
55 59 localWorks.remove(localWork);
... ... @@ -58,6 +62,7 @@ public class PTCRISync {
58 62 }
59 63  
60 64 progressHandler.setCurrentStatus("ORCID_SYNC_EXPORT_UPDATING_WORKS");
  65 + _log.info("[export] " + "ORCID_SYNC_EXPORT_UPDATING_WORKS");
61 66 for (int counter = 0; counter != recordsToUpdate.size(); counter++) {
62 67 progress = (int) ((double) ((double) counter / recordsToUpdate.size()) * 100);
63 68 progressHandler.setProgress(progress);
... ... @@ -66,6 +71,7 @@ public class PTCRISync {
66 71 }
67 72  
68 73 progressHandler.setCurrentStatus("ORCID_SYNC_EXPORT_ADDING_WORKS");
  74 + _log.info("[export] " + "ORCID_SYNC_EXPORT_ADDING_WORKS");
69 75 for (int counter = 0; counter != localWorks.size(); counter++) {
70 76 progress = (int) ((double) ((double) counter / localWorks.size()) * 100);
71 77 progressHandler.setProgress(progress);
... ...