Skip to content

Commit

Permalink
log task name and task mode as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Bram Daams committed Aug 19, 2024
1 parent 1e42009 commit d6dc371
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion BUILD.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Build distribution
==================

$ mvn -Popendj clean package
$ mvn -Popendj --file pom.xml clean package

tar.gz and .zip files available in target/ directory

Expand Down
24 changes: 14 additions & 10 deletions src/main/java/org/lsc/AbstractSynchronize.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected final boolean clean2Ldap(Task task) {
LOGGER.info("If you want to avoid this message, " + "increase the time limit by using dedicated parameter.");
}

logStatus(counter);
logStatus(task.getName(), Task.Mode.clean.toString(), counter);
return counter.getCountError() == 0;
}

Expand Down Expand Up @@ -231,7 +231,7 @@ protected final boolean synchronize2Ldap(final Task task) {
LOGGER.info("If you want to avoid this message, " + "increase the time limit by using dedicated parameter.");
}

logStatus(counter);
logStatus(task.getName(), Task.Mode.clean.toString(), counter);
return counter.getCountError() == 0;
}

Expand Down Expand Up @@ -298,7 +298,7 @@ public final String getTaskFullStatus(final String syncName) {
if(asyncThread != null && asyncThread.isAlive()) {
AsynchronousRunner asyncRunner = mapSTasks.get(syncName);
InfoCounter counter = asyncRunner.getCounter();
return getLogStatus(counter);
return getLogStatus(syncName, Task.Mode.async.toString(), counter);
} else {
return null;
}
Expand Down Expand Up @@ -392,20 +392,24 @@ public final void logShouldAction(final LscModifications lm, final String syncNa
LSCStructuralLogger.DESTINATION.debug("", lm);
}

protected void logStatus(InfoCounter counter) {
String totalsLogMessage = getLogStatus(counter);
protected void logStatus(String taskName, String taskMode, InfoCounter counter) {
String totalsLogMessage = getLogStatus(taskName, taskMode, counter);
if (counter.getCountError() > 0) {
LOGGER.error(totalsLogMessage);
} else {
LOGGER.info(totalsLogMessage);
}
}

protected String getLogStatus(InfoCounter counter) {
return "All entries: "+ counter.getCountAll() +
", to modify entries: "+ counter.getCountModifiable() +
", successfully modified entries: "+counter.getCountCompleted()+
", errors: "+counter.getCountError();
protected String getLogStatus(String taskName, String taskMode, InfoCounter counter) {

String totalsLogMessage =
taskName + " - " + taskMode +
" - All entries: "+ counter.getCountAll() +
", to modify entries: "+ counter.getCountModifiable() +
", successfully modified entries: "+counter.getCountCompleted()+
", errors: "+counter.getCountError();
return totalsLogMessage;
}

public IBean getBean(Task task, IService service, String pivotName, LscDatasets pivotAttributes, boolean fromSameService, boolean fromSource) throws LscServiceException {
Expand Down

0 comments on commit d6dc371

Please sign in to comment.