diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcRpcManager.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcRpcManager.java
index 7ecfd79..ec79725 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcRpcManager.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcRpcManager.java
@@ -260,6 +260,8 @@
                 Instr3GppMob instr3GppMob = (Instr3GppMob) instructions.instrType();
                 String commands = Bits.toString(instr3GppMob.instr3GppMob().bits());
 
+                log.info("handling configure create event {} for {}", commands, dpn.dpnId());
+
                 Ip4Address s1u_enodeb_ipv4 = Ip4Address.valueOf(context.ul().tunnelLocalAddress().toString()),
                         s1u_sgw_ipv4 = Ip4Address.valueOf(context.ul().tunnelRemoteAddress().toString());
 
@@ -417,6 +419,8 @@
                 Instr3GppMob instr3GppMob = (Instr3GppMob) instructions.instrType();
                 String commands = Bits.toString(instr3GppMob.instr3GppMob().bits());
 
+                log.info("handling configure update event {} for {}", commands, dpn.dpnId());
+
                 Ip4Address s1u_enodeb_ipv4 = Ip4Address.valueOf(context.ul().tunnelLocalAddress().toString()),
                         s1u_sgw_ipv4 = Ip4Address.valueOf(context.ul().tunnelRemoteAddress().toString());
 
@@ -523,6 +527,8 @@
                 throw new RuntimeException("Context doesn't exist. Please issue create operation..");
             }
 
+            log.info("handling configure-delete {}", targetStr);
+
             DefaultContexts context = defaultContexts.get();
             for (Dpns dpn : context.dpns()) {
                 Optional<DefaultDpns> optionalDpn = cacheManager.dpnsCache.get(dpn.dpnId());
@@ -720,7 +726,7 @@
             try {
                 for (ModelObject modelObject : getModelObjects(rpcInput.data(), configureDpn)) {
                     DefaultConfigureDpnInput input = (DefaultConfigureDpnInput) modelObject;
-                    log.debug("configure-dpn event {}", input);
+                    log.info("configure-dpn event");
                     switch (input.operation().enumeration()) {
                         case ADD:
                             configureDpnOutput = configureDpnAdd(input);
@@ -758,7 +764,7 @@
             try {
                 for (ModelObject modelObject : getModelObjects(rpcInput.data(), configure)) {
                     DefaultConfigureInput input = (DefaultConfigureInput) modelObject;
-                    log.debug("configure event {}", input);
+                    log.info("configure event {}", input.clientId());
                     if (!clientInfo.containsKey(input.clientId())) {
                         throw new RuntimeException("Client Identifier is not registered.");
                     }
@@ -818,7 +824,7 @@
             try {
                 for (ModelObject modelObject : getModelObjects(rpcInput.data(), configureBundles)) {
                     DefaultConfigureBundlesInput input = (DefaultConfigureBundlesInput) modelObject;
-                    log.debug("configure-bundles event {}", input);
+                    log.info("configure-bundles event {}", input.clientId());
                     if (!clientInfo.containsKey(input.clientId())) {
                         throw new RuntimeException("Client Identifier is not registered.");
                     }
@@ -913,7 +919,7 @@
             try {
                 for (ModelObject modelObject : getModelObjects(rpcInput.data(), registerClient)) {
                     DefaultRegisterClientInput input = (DefaultRegisterClientInput) modelObject;
-                    log.debug("register-client event {}", input);
+                    log.info("register-client event {}", input.clientId());
                     if (clientInfo.containsKey(input.clientId())) {
                         throw new RuntimeException("Client already registered.");
                     }
@@ -969,7 +975,7 @@
             try {
                 for (ModelObject modelObject : getModelObjects(rpcInput.data(), registerClient)) {
                     DefaultRegisterClientInput input = (DefaultRegisterClientInput) modelObject;
-                    log.debug("deregister-client event {}", input);
+                    log.info("deregister-client event {}", input.clientId());
                     if (!clientInfo.containsKey(input.clientId())) {
                         throw new RuntimeException("Client does not exist.");
                     }
@@ -1061,7 +1067,6 @@
                 Optional<DefaultTenant> defaultTenant = getTenant(clientInput.tenantId());
                 if (defaultTenant.isPresent()) {
                     DefaultTenant tenant = defaultTenant.get();
-                    log.debug("tenant {}", tenant);
                     if (tenant.fpcTopology().dpns() != null) {
                         tenant.fpcTopology().dpns().forEach(
                                 dpn -> {
