Add more error logging

Change-Id: I0e4feede9f23db9026635b79a3580675eef05733
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java
index 20debc1..8a50580 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java
@@ -18,6 +18,8 @@
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 
@@ -211,6 +213,14 @@
                 }
             }
         }
+
+        @Override
+        public String toString() {
+            return MoreObjects.toStringHelper(this)
+                    .add("pendingContexts", pendingContexts)
+                    .add("errorContexts", errorContexts)
+                    .toString();
+        }
     }
 
     // --- Utilities to support various installable Intent ----
@@ -232,7 +242,12 @@
             contexts.add(new ProtectionConfigOperationContext(intentContext));
         }
 
-        return contexts.isEmpty() ? ImmutableSet.of(new ErrorContext(intentContext)) : contexts;
+        if (contexts.isEmpty()) {
+            log.warn("{} did not contain installable Intents", intentContext);
+            return ImmutableSet.of(new ErrorContext(intentContext));
+        }
+
+        return contexts;
     }
 
     private boolean isInstallable(Optional<IntentData> toUninstall, Optional<IntentData> toInstall,
@@ -410,6 +425,19 @@
                    intent instanceof FlowObjectiveIntent ||
                    intent instanceof ProtectionEndpointIntent;
         }
+
+        protected ToStringHelper toStringHelper() {
+            return MoreObjects.toStringHelper(this)
+                    .add("intentContext", intentContext)
+                    .add("toUninstall", toUninstall)
+                    .add("toInstall", toInstall);
+        }
+
+        @Override
+        public String toString() {
+            return toStringHelper()
+                    .toString();
+        }
     }
 
 
@@ -473,6 +501,13 @@
         public Object error() {
             return flowRuleOperationsContext;
         }
+
+        @Override
+        protected ToStringHelper toStringHelper() {
+            return super.toStringHelper()
+                    .omitNullValues()
+                    .add("flowRuleOperationsContext", flowRuleOperationsContext);
+        }
     }
 
     // Context for applying and tracking operations related to flow objective intents.
@@ -534,6 +569,15 @@
             return errorContexts;
         }
 
+        @Override
+        protected ToStringHelper toStringHelper() {
+            return super.toStringHelper()
+                    .add("contexts", contexts)
+                    .add("pendingContexts", pendingContexts)
+                    .add("errorContexts", errorContexts);
+        }
+
+
         private class FlowObjectiveInstallationContext implements ObjectiveContext {
             Objective objective;
             DeviceId deviceId;
@@ -699,5 +743,11 @@
                                  .collect(Collectors.toList())));
         }
 
+        @Override
+        protected ToStringHelper toStringHelper() {
+            return super.toStringHelper()
+                    .add("stages", stages)
+                    .add("failed", failed);
+        }
     }
 }