details:   https://code.openbravo.com/erp/devel/pi/rev/b5da46fd9c1c
changeset: 35525:b5da46fd9c1c
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Mon Mar 11 11:59:35 2019 +0100
summary:   fixed issue 40347: improved log of ImportEntryManager
  * Log number of entries processed if any
  * Log new wait time if entries were processed
  * Reduce level to trace for each processed entry

diffstat:

 src/org/openbravo/service/importprocess/ImportEntryManager.java |  15 ++++-----
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (40 lines):

diff -r c865aacf9fd9 -r b5da46fd9c1c 
src/org/openbravo/service/importprocess/ImportEntryManager.java
--- a/src/org/openbravo/service/importprocess/ImportEntryManager.java   Fri Mar 
08 23:47:30 2019 +0100
+++ b/src/org/openbravo/service/importprocess/ImportEntryManager.java   Mon Mar 
11 11:59:35 2019 +0100
@@ -560,8 +560,7 @@
               // don't block eachother with the limited batch size
               // being read
               for (String typeOfData : typesOfData) {
-
-                log.debug("Reading import entries for type of data " + 
typeOfData);
+                log.debug("Reading import entries for type of data {}", 
typeOfData);
 
                 final String importEntryQryStr = "from " + 
ImportEntry.ENTITY_NAME + " where "
                     + ImportEntry.PROPERTY_TYPEOFDATA + "='" + typeOfData + "' 
and "
@@ -582,9 +581,7 @@
                     entryCount++;
                     final ImportEntry entry = (ImportEntry) entries.get(0);
 
-                    if (log.isDebugEnabled()) {
-                      log.debug("Handle import entry " + 
entry.getIdentifier());
-                    }
+                    log.trace("Handle import entry {}", () -> 
entry.getIdentifier());
 
                     try {
                       manager.handleImportEntry(entry);
@@ -623,10 +620,12 @@
                   // in case of test don't wait minimal 2 seconds
                   Thread.sleep(300 + ((1000 * entryCount) / 30));
                 } else {
+                  // wait minimal 2 seconds or based on entry count
+                  long t = Math.max(2000, 300 + ((1000 * entryCount) / 30));
                   log.debug(
-                      "Entries have been processed, wait a shorter time, and 
try again to capture new entries which have been added");
-                  // wait minimal 2 seconds or based on entry count
-                  Thread.sleep(Math.max(2000, 300 + ((1000 * entryCount) / 
30)));
+                      "{} entries have been processed. Wait {} ms, and try 
again to capture new entries which have been added",
+                      entryCount, t);
+                  Thread.sleep(t);
                 }
               } catch (Exception ignored) {
               }


_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to