changeset 74:7acd7564e394

nicer logging.
author casties
date Fri, 03 Feb 2017 12:56:28 +0100
parents ab61cd3ad0e0
children e0be7c0030f5
files src/main/java/org/mpi/openmind/repository/services/AbstractPersistenceService.java
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/org/mpi/openmind/repository/services/AbstractPersistenceService.java	Thu Feb 02 19:02:05 2017 +0100
+++ b/src/main/java/org/mpi/openmind/repository/services/AbstractPersistenceService.java	Fri Feb 03 12:56:28 2017 +0100
@@ -668,15 +668,14 @@
 	 */
 	private void refreshRelationTarget(Session session, Relation rel) throws Exception {
 		long targetModifOld = rel.getTargetModif();
-		StringBuilder sb = new StringBuilder("refreshTarget\n" + rel.toString() + "\n");
-		sb.append(rel.printTarget() + "\n");
+		StringBuilder sb = new StringBuilder("refreshTarget of " + rel.toString() + " to "+rel.printTarget());
 		List<Entity> entityList = this.getEntities(session, rel.getTargetId(), Node.SYS_STATUS_CURRENT_VERSION, rel.getType(), null, false);
 		if(entityList.isEmpty()){
 			throw new Exception("Saving entity " + rel.getSourceId() + ", the system found a relation without target. " + rel.toString());
 		}
 		Entity target = entityList.get(0);
 		rel.setTarget(target);
-		sb.append(rel.printTarget() + "\n");
+		sb.append(" new "+rel.printTarget());
 		// the refresh is logged only if we detect a difference between the relation and the target entity.
 		if(targetModifOld != rel.getTargetModif()){
 			logger.warn(sb.toString());
@@ -694,15 +693,14 @@
 	 */
 	private void refreshRelationSource(Session session, Relation rel) throws Exception {
 		long sourceModifOld = rel.getSourceModif();
-		StringBuilder sb = new StringBuilder("refreshSource\n" + rel.toString() + "\n");
-		sb.append(rel.printSource() + "\n");
+		StringBuilder sb = new StringBuilder("refreshSource of " + rel.toString() + " to "+rel.printSource());
 		List<Entity> entityList = this.getEntities(session, rel.getSourceId(), Node.SYS_STATUS_CURRENT_VERSION, rel.getType(), null, false);
 		if(entityList.isEmpty()){
 			throw new Exception("Saving entity " + rel.getTargetId() + ", the system found a relation without source. " + rel.toString());
 		}
 		Entity source = entityList.get(0);
 		rel.setSource(source);
-		sb.append(rel.printSource() + "\n");
+		sb.append(" new "+rel.printSource());
 		// the refresh is logged only if we detect a difference between the relation and the source entity.
 		if(sourceModifOld != rel.getSourceModif()){
 			logger.warn(sb.toString());