From 001acd2421967297666d7f4a92e45afe5bb715ae Mon Sep 17 00:00:00 2001 From: tpantelis Date: Sat, 31 Jan 2015 00:18:30 -0500 Subject: [PATCH] Improve cluster test app logging Made a few improvements to the logging in PeopleCarListener and PeopleProvider to help debugging test failures. Change-Id: I25d27e4abbc4b0096b2dc812bfcbada208c588e4 Signed-off-by: tpantelis --- .../clustering/it/listener/PeopleCarListener.java | 7 ++++--- .../controller/clustering/it/provider/PeopleProvider.java | 7 +++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java index 4737d6eb49..bbaf6becf4 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java @@ -38,7 +38,6 @@ public class PeopleCarListener implements CarPurchaseListener { @Override public void onCarBought(CarBought notification) { - log.info("onCarBought notification : Adding car person entry"); final CarPersonBuilder carPersonBuilder = new CarPersonBuilder(); carPersonBuilder.setCarId(notification.getCarId()); @@ -47,6 +46,8 @@ public class PeopleCarListener implements CarPurchaseListener { carPersonBuilder.setKey(key); final CarPerson carPerson = carPersonBuilder.build(); + log.info("Car bought, adding car-person entry: [{}]", carPerson); + InstanceIdentifier carPersonIId = InstanceIdentifier.builder(CarPeople.class).child(CarPerson.class, carPerson.getKey()).build(); @@ -57,12 +58,12 @@ public class PeopleCarListener implements CarPurchaseListener { Futures.addCallback(tx.submit(), new FutureCallback() { @Override public void onSuccess(final Void result) { - log.info("Car bought, entry added to map of people and car [{}]", carPerson); + log.info("Successfully added car-person entry: [{}]", carPerson); } @Override public void onFailure(final Throwable t) { - log.info("Car bought, Failed entry addition to map of people and car [{}]", carPerson); + log.error(String.format("Failed to add car-person entry: [%s]", carPerson), t); } }); diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java index e0d3f75349..ef666817e8 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java @@ -11,6 +11,7 @@ package org.opendaylight.controller.clustering.it.provider; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.SettableFuture; +import java.util.concurrent.Future; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; @@ -22,15 +23,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.PersonContext; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.people.Person; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.sal.clustering.it.people.rev140818.people.PersonBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.RpcError; import org.opendaylight.yangtools.yang.common.RpcResult; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.concurrent.Future; - public class PeopleProvider implements PeopleService, AutoCloseable { private static final Logger log = LoggerFactory.getLogger(PeopleProvider.class); @@ -76,7 +75,7 @@ public class PeopleProvider implements PeopleService, AutoCloseable { @Override public void onFailure(final Throwable t) { - log.info("RPC addPerson : person addition failed [{}]", person); + log.error(String.format("RPC addPerson : person addition failed [%s]", person), t); futureResult.set(RpcResultBuilder.failed() .withError(RpcError.ErrorType.APPLICATION, t.getMessage()).build()); } -- 2.36.6